<!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 <sam@webkit.org>
+
+ [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 <eric.carlson@apple.com>
</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("event.initDeviceMotionEvent('', false, false, {x: objectThrowingException, y: 1, z: 2}, {x: 3, y: 4, z: 5}, {alpha: 6, beta: 7, gamma: 8}, 9)", "Error: valueOf threw exception");
</span><span class="cx"> testException("event.initDeviceMotionEvent('', false, false, {x: 0, y: 1, z: 2}, {x: 3, y: objectThrowingException, z: 5}, {alpha: 6, beta: 7, gamma: 8}, 9)", "Error: valueOf threw exception");
</span><span class="cx"> testException("event.initDeviceMotionEvent('', false, false, {x: 0, y: 1, z: 2}, {x: 3, y: 4, z: 5}, {alpha: 6, beta: 7, gamma: objectThrowingException}, 9)", "Error: valueOf threw exception");
</span><ins>+testException("event.initDeviceMotionEvent('', false, false, '', '', '', '')", "TypeError: Type error");
</ins><span class="cx">
</span><span class="cx"> evalAndLog("event.initDeviceMotionEvent('', false, false, {y: 1, x: 0}, {x: 3, z: 5}, {gamma: 8, beta: 7}, 9)");
</span><span class="cx"> shouldBeTrue("event.acceleration.x == 0");
</span><span class="lines">@@ -69,12 +70,6 @@
</span><span class="cx"> shouldBeTrue("event.rotationRate == null");
</span><span class="cx"> shouldBeTrue("event.interval == null");
</span><span class="cx">
</span><del>-evalAndLog("event.initDeviceMotionEvent('', false, false, '', '', '', '')");
-shouldBeTrue("event.acceleration == null");
-shouldBeTrue("event.accelerationIncludingGravity == null");
-shouldBeTrue("event.rotationRate == null");
-shouldBeTrue("event.interval == 0");
-
</del><span class="cx"> evalAndLog("event.initDeviceMotionEvent('', false, false, null, null, null, null)");
</span><span class="cx"> shouldBeTrue("event.acceleration == null");
</span><span class="cx"> shouldBeTrue("event.accelerationIncludingGravity == null");
</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 <sam@webkit.org>
+
+ [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 <zdobersek@igalia.com>
</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 = "<group>"; };
</span><span class="cx">                 31FB1A63120A5D3F00DC02A0 /* JSDeviceMotionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeviceMotionEvent.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 31FB1A64120A5D3F00DC02A0 /* JSDeviceMotionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDeviceMotionEvent.h; sourceTree = "<group>"; };
</span><del>-                31FB1A6B120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeviceMotionEventCustom.cpp; sourceTree = "<group>"; };
</del><span class="cx">                 3314ACE910892086000F0E56 /* JSExceptionBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSExceptionBase.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 3314ACEA10892086000F0E56 /* JSExceptionBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSExceptionBase.h; sourceTree = "<group>"; };
</span><span class="cx">                 331FF67DE197B57393C46A7F /* RenderMathMLPadded.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMathMLPadded.h; sourceTree = "<group>"; };
</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 = "<group>"; };
</span><span class="cx">                 5905ADBE1302F3CE00F116DF /* XMLTreeViewer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLTreeViewer.h; sourceTree = "<group>"; };
</span><span class="cx">                 590E1B4811E4EF4B0069F784 /* DeviceOrientationData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceOrientationData.h; sourceTree = "<group>"; };
</span><del>-                590E1B4A11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeviceOrientationEventCustom.cpp; sourceTree = "<group>"; };
</del><span class="cx">                 59309A1011F4AE5800250603 /* DeviceOrientationClientMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceOrientationClientMock.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceOrientationClientMock.h; sourceTree = "<group>"; };
</span><span class="cx">                 5958F1CB1343917C0080B31F /* XMLViewer.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = XMLViewer.css; sourceTree = "<group>"; };
</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() -> decltype(T::nullValue()) { return T::nullValue(); }
</ins><span class="cx"> template<typename U> static inline bool isNullValue(U&& value) { return T::isNullValue(std::forward<U>(value)); }
</span><del>- template<typename U> static inline U&& extractValueFromNullable(U&& value) { return T::extractValueFromNullable(std::forward<U>(value)); }
</del><ins>+ template<typename U> static inline auto extractValueFromNullable(U&& value) -> decltype(T::extractValueFromNullable(std::forward<U>(value))) { return T::extractValueFromNullable(std::forward<U>(value)); }
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> template<typename T> struct IDLSequence : IDLType<Vector<typename T::ImplementationType>> {
</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 "JSDOMWindowProperties.cpp"
</span><span class="cx"> #include "JSDOMWindowShell.cpp"
</span><span class="cx"> #include "JSDOMWrapper.cpp"
</span><del>-#include "JSDeviceOrientationEventCustom.cpp"
</del><span class="cx"> #include "JSDocumentCustom.cpp"
</span><span class="cx"> #include "JSDocumentFragmentCustom.cpp"
</span><span class="cx"> #include "JSElementCustom.cpp"
</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 "config.h"
-
-#if ENABLE(DEVICE_ORIENTATION)
-
-#include "JSDeviceMotionEvent.h"
-
-#include "DeviceMotionData.h"
-#include "DeviceMotionEvent.h"
-#include <heap/HeapInlines.h>
-#include <runtime/AuxiliaryBarrierInlines.h>
-#include <runtime/IdentifierInlines.h>
-#include <runtime/JSCJSValueInlines.h>
-#include <runtime/JSObjectInlines.h>
-#include <runtime/ObjectConstructor.h>
-#include <runtime/StructureInlines.h>
-
-using namespace JSC;
-
-namespace WebCore {
-
-static RefPtr<DeviceMotionData::Acceleration> readAccelerationArgument(JSValue value, ExecState& state)
-{
- if (value.isUndefinedOrNull())
- return nullptr;
-
- VM& vm = state.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- // Given the above test, this will always yield an object.
- JSObject* object = value.toObject(&state);
- ASSERT(!scope.exception());
-
- JSValue xValue = object->get(&state, Identifier::fromString(&state, "x"));
- RETURN_IF_EXCEPTION(scope, nullptr);
- bool canProvideX = !xValue.isUndefinedOrNull();
- double x = xValue.toNumber(&state);
- RETURN_IF_EXCEPTION(scope, nullptr);
-
- JSValue yValue = object->get(&state, Identifier::fromString(&state, "y"));
- RETURN_IF_EXCEPTION(scope, nullptr);
- bool canProvideY = !yValue.isUndefinedOrNull();
- double y = yValue.toNumber(&state);
- RETURN_IF_EXCEPTION(scope, nullptr);
-
- JSValue zValue = object->get(&state, Identifier::fromString(&state, "z"));
- RETURN_IF_EXCEPTION(scope, nullptr);
- bool canProvideZ = !zValue.isUndefinedOrNull();
- double z = zValue.toNumber(&state);
- RETURN_IF_EXCEPTION(scope, nullptr);
-
- if (!canProvideX && !canProvideY && !canProvideZ)
- return nullptr;
-
- return DeviceMotionData::Acceleration::create(canProvideX, x, canProvideY, y, canProvideZ, z);
-}
-
-static RefPtr<DeviceMotionData::RotationRate> readRotationRateArgument(JSValue value, ExecState& state)
-{
- if (value.isUndefinedOrNull())
- return nullptr;
-
- VM& vm = state.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- // Given the above test, this will always yield an object.
- JSObject* object = value.toObject(&state);
- ASSERT(!scope.exception());
-
- JSValue alphaValue = object->get(&state, Identifier::fromString(&state, "alpha"));
- RETURN_IF_EXCEPTION(scope, nullptr);
- bool canProvideAlpha = !alphaValue.isUndefinedOrNull();
- double alpha = alphaValue.toNumber(&state);
- RETURN_IF_EXCEPTION(scope, nullptr);
-
- JSValue betaValue = object->get(&state, Identifier::fromString(&state, "beta"));
- RETURN_IF_EXCEPTION(scope, nullptr);
- bool canProvideBeta = !betaValue.isUndefinedOrNull();
- double beta = betaValue.toNumber(&state);
- RETURN_IF_EXCEPTION(scope, nullptr);
-
- JSValue gammaValue = object->get(&state, Identifier::fromString(&state, "gamma"));
- RETURN_IF_EXCEPTION(scope, nullptr);
- bool canProvideGamma = !gammaValue.isUndefinedOrNull();
- double gamma = gammaValue.toNumber(&state);
- RETURN_IF_EXCEPTION(scope, nullptr);
-
- if (!canProvideAlpha && !canProvideBeta && !canProvideGamma)
- return nullptr;
-
- return DeviceMotionData::RotationRate::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma);
-}
-
-static JSObject* createAccelerationObject(const DeviceMotionData::Acceleration* acceleration, ExecState& state)
-{
- JSObject* object = constructEmptyObject(&state);
- object->putDirect(state.vm(), Identifier::fromString(&state, "x"), acceleration->canProvideX() ? jsNumber(acceleration->x()) : jsNull());
- object->putDirect(state.vm(), Identifier::fromString(&state, "y"), acceleration->canProvideY() ? jsNumber(acceleration->y()) : jsNull());
- object->putDirect(state.vm(), Identifier::fromString(&state, "z"), acceleration->canProvideZ() ? jsNumber(acceleration->z()) : jsNull());
- return object;
-}
-
-static JSObject* createRotationRateObject(const DeviceMotionData::RotationRate* rotationRate, ExecState& state)
-{
- JSObject* object = constructEmptyObject(&state);
- object->putDirect(state.vm(), Identifier::fromString(&state, "alpha"), rotationRate->canProvideAlpha() ? jsNumber(rotationRate->alpha()) : jsNull());
- object->putDirect(state.vm(), Identifier::fromString(&state, "beta"), rotationRate->canProvideBeta() ? jsNumber(rotationRate->beta()) : jsNull());
- object->putDirect(state.vm(), Identifier::fromString(&state, "gamma"), rotationRate->canProvideGamma() ? jsNumber(rotationRate->gamma()) : jsNull());
- return object;
-}
-
-JSValue JSDeviceMotionEvent::acceleration(ExecState& state) const
-{
- DeviceMotionEvent& imp = wrapped();
- if (!imp.deviceMotionData()->acceleration())
- return jsNull();
- return createAccelerationObject(imp.deviceMotionData()->acceleration(), state);
-}
-
-JSValue JSDeviceMotionEvent::accelerationIncludingGravity(ExecState& state) const
-{
- DeviceMotionEvent& imp = wrapped();
- if (!imp.deviceMotionData()->accelerationIncludingGravity())
- return jsNull();
- return createAccelerationObject(imp.deviceMotionData()->accelerationIncludingGravity(), state);
-}
-
-JSValue JSDeviceMotionEvent::rotationRate(ExecState& state) const
-{
- DeviceMotionEvent& imp = wrapped();
- if (!imp.deviceMotionData()->rotationRate())
- return jsNull();
- return createRotationRateObject(imp.deviceMotionData()->rotationRate(), state);
-}
-
-JSValue JSDeviceMotionEvent::interval(ExecState&) const
-{
- DeviceMotionEvent& imp = wrapped();
- if (!imp.deviceMotionData()->canProvideInterval())
- return jsNull();
- return jsNumber(imp.deviceMotionData()->interval());
-}
-
-JSValue JSDeviceMotionEvent::initDeviceMotionEvent(ExecState& state)
-{
- VM& vm = state.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- const String type = state.argument(0).toWTFString(&state);
- bool bubbles = state.argument(1).toBoolean(&state);
- bool cancelable = state.argument(2).toBoolean(&state);
-
- // If any of the parameters are null or undefined, mark them as not provided.
- // Otherwise, use the standard JavaScript conversion.
- RefPtr<DeviceMotionData::Acceleration> acceleration = readAccelerationArgument(state.argument(3), state);
- RETURN_IF_EXCEPTION(scope, JSValue());
-
- RefPtr<DeviceMotionData::Acceleration> accelerationIncludingGravity = readAccelerationArgument(state.argument(4), state);
- RETURN_IF_EXCEPTION(scope, JSValue());
-
- RefPtr<DeviceMotionData::RotationRate> rotationRate = readRotationRateArgument(state.argument(5), state);
- RETURN_IF_EXCEPTION(scope, JSValue());
-
- bool intervalProvided = !state.argument(6).isUndefinedOrNull();
- double interval = state.argument(6).toNumber(&state);
- auto deviceMotionData = DeviceMotionData::create(WTFMove(acceleration), WTFMove(accelerationIncludingGravity), WTFMove(rotationRate), intervalProvided, interval);
- wrapped().initDeviceMotionEvent(type, bubbles, cancelable, deviceMotionData.ptr());
- return jsUndefined();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(DEVICE_ORIENTATION)
</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 "config.h"
-
-#if ENABLE(DEVICE_ORIENTATION)
-
-#include "JSDeviceOrientationEvent.h"
-
-#include "DeviceOrientationData.h"
-#include "DeviceOrientationEvent.h"
-#include <heap/HeapInlines.h>
-#include <runtime/JSCJSValueInlines.h>
-#include <runtime/StructureInlines.h>
-
-using namespace JSC;
-
-namespace WebCore {
-
-JSValue JSDeviceOrientationEvent::alpha(ExecState&) const
-{
- DeviceOrientationEvent& imp = wrapped();
- if (!imp.orientation()->canProvideAlpha())
- return jsNull();
- return jsNumber(imp.orientation()->alpha());
-}
-
-JSValue JSDeviceOrientationEvent::beta(ExecState&) const
-{
- DeviceOrientationEvent& imp = wrapped();
- if (!imp.orientation()->canProvideBeta())
- return jsNull();
- return jsNumber(imp.orientation()->beta());
-}
-
-JSValue JSDeviceOrientationEvent::gamma(ExecState&) const
-{
- DeviceOrientationEvent& imp = wrapped();
- if (!imp.orientation()->canProvideGamma())
- return jsNull();
- return jsNumber(imp.orientation()->gamma());
-}
-
-#if PLATFORM(IOS)
-JSValue JSDeviceOrientationEvent::webkitCompassHeading(ExecState&) const
-{
- DeviceOrientationEvent& imp = wrapped();
- if (!imp.orientation()->canProvideCompassHeading())
- return jsNull();
- return jsNumber(imp.orientation()->compassHeading());
-}
-
-JSValue JSDeviceOrientationEvent::webkitCompassAccuracy(ExecState&) const
-{
- DeviceOrientationEvent& imp = wrapped();
- if (!imp.orientation()->canProvideCompassAccuracy())
- return jsNull();
- return jsNumber(imp.orientation()->compassAccuracy());
-}
-#endif
-
-#if !PLATFORM(IOS)
-JSValue JSDeviceOrientationEvent::absolute(ExecState&) const
-{
- DeviceOrientationEvent& imp = wrapped();
- if (!imp.orientation()->canProvideAbsolute())
- return jsNull();
- return jsBoolean(imp.orientation()->absolute());
-}
-#endif
-
-JSValue JSDeviceOrientationEvent::initDeviceOrientationEvent(ExecState& state)
-{
- const String type = state.argument(0).toWTFString(&state);
- bool bubbles = state.argument(1).toBoolean(&state);
- bool cancelable = state.argument(2).toBoolean(&state);
- // If alpha, beta or gamma are null or undefined, mark them as not provided.
- // Otherwise, use the standard JavaScript conversion.
- bool alphaProvided = !state.argument(3).isUndefinedOrNull();
- double alpha = state.argument(3).toNumber(&state);
- bool betaProvided = !state.argument(4).isUndefinedOrNull();
- double beta = state.argument(4).toNumber(&state);
- bool gammaProvided = !state.argument(5).isUndefinedOrNull();
- double gamma = state.argument(5).toNumber(&state);
-#if PLATFORM(IOS)
- bool compassHeadingProvided = !state.argument(6).isUndefinedOrNull();
- double compassHeading = state.argument(6).toNumber(&state);
- bool compassAccuracyProvided = !state.argument(7).isUndefinedOrNull();
- double compassAccuracy = state.argument(7).toNumber(&state);
- RefPtr<DeviceOrientationData> orientation = DeviceOrientationData::create(alphaProvided, alpha, betaProvided, beta, gammaProvided, gamma, compassHeadingProvided, compassHeading, compassAccuracyProvided, compassAccuracy);
-#else
- bool absoluteProvided = !state.argument(6).isUndefinedOrNull();
- bool absolute = state.argument(6).toBoolean(&state);
- RefPtr<DeviceOrientationData> orientation = DeviceOrientationData::create(alphaProvided, alpha, betaProvided, beta, gammaProvided, gamma, absoluteProvided, absolute);
-#endif
- wrapped().initDeviceOrientationEvent(type, bubbles, cancelable, orientation.get());
- return jsUndefined();
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(DEVICE_ORIENTATION)
</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<DeviceMotionData::Acceleration> DeviceMotionData::Acceleration::create(bool canProvideX, double x,
- bool canProvideY, double y,
- bool canProvideZ, double z)
-{
- return adoptRef(*new DeviceMotionData::Acceleration(canProvideX, x, canProvideY, y, canProvideZ, z));
-}
-
-DeviceMotionData::Acceleration::Acceleration(bool canProvideX, double x, bool canProvideY, double y, bool canProvideZ, double z)
- : m_x(x)
- , m_y(y)
- , m_z(z)
- , m_canProvideX(canProvideX)
- , m_canProvideY(canProvideY)
- , m_canProvideZ(canProvideZ)
-
-{
-}
-
-Ref<DeviceMotionData::RotationRate> DeviceMotionData::RotationRate::create(bool canProvideAlpha, double alpha,
- bool canProvideBeta, double beta,
- bool canProvideGamma, double gamma)
-{
- return adoptRef(*new DeviceMotionData::RotationRate(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma));
-}
-
-DeviceMotionData::RotationRate::RotationRate(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma)
- : m_alpha(alpha)
- , m_beta(beta)
- , m_gamma(gamma)
- , m_canProvideAlpha(canProvideAlpha)
- , m_canProvideBeta(canProvideBeta)
- , m_canProvideGamma(canProvideGamma)
-{
-}
-
</del><span class="cx"> Ref<DeviceMotionData> 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<DeviceMotionData> DeviceMotionData::create(RefPtr<Acceleration>&& acceleration, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&& rotationRate, bool canProvideInterval, double interval)
</del><ins>+Ref<DeviceMotionData> DeviceMotionData::create(RefPtr<Acceleration>&& acceleration, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&& rotationRate, std::optional<double> 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<Acceleration>&& acceleration, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&& rotationRate, bool canProvideInterval, double interval)
</del><ins>+DeviceMotionData::DeviceMotionData(RefPtr<Acceleration>&& acceleration, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&& rotationRate, std::optional<double> 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 <wtf/Optional.h>
</ins><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="cx"> #include <wtf/RefPtr.h>
</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<DeviceMotionData::Acceleration> {
</span><span class="cx"> public:
</span><del>- WEBCORE_EXPORT static Ref<Acceleration> create(bool canProvideX, double x, bool canProvideY, double y, bool canProvideZ, double z);
</del><ins>+ static Ref<Acceleration> create()
+ {
+ return adoptRef(*new Acceleration);
+ }
+ static Ref<Acceleration> create(std::optional<double> x, std::optional<double> y, std::optional<double> z)
+ {
+ return adoptRef(*new Acceleration(x, y, z));
+ }
</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<double> x() const { return m_x; }
+ std::optional<double> y() const { return m_y; }
+ std::optional<double> 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<double> x, std::optional<double> y, std::optional<double> 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<double> m_x;
+ std::optional<double> m_y;
+ std::optional<double> m_z;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> class RotationRate : public RefCounted<DeviceMotionData::RotationRate> {
</span><span class="cx"> public:
</span><del>- WEBCORE_EXPORT static Ref<RotationRate> create(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma);
</del><ins>+ static Ref<RotationRate> create()
+ {
+ return adoptRef(*new RotationRate);
+ }
+ static Ref<RotationRate> create(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma)
+ {
+ return adoptRef(*new RotationRate(alpha, beta, gamma));
+ }
</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<double> alpha() const { return m_alpha; }
+ std::optional<double> beta() const { return m_beta; }
+ std::optional<double> 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<double> alpha, std::optional<double> beta, std::optional<double> 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<double> m_alpha;
+ std::optional<double> m_beta;
+ std::optional<double> m_gamma;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT static Ref<DeviceMotionData> create();
</span><del>- WEBCORE_EXPORT static Ref<DeviceMotionData> create(RefPtr<Acceleration>&&, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&&, bool canProvideInterval, double interval);
</del><ins>+ WEBCORE_EXPORT static Ref<DeviceMotionData> create(RefPtr<Acceleration>&&, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&&, std::optional<double> 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<double> interval() const { return m_interval; }
</ins><span class="cx">
</span><span class="cx"> private:
</span><del>- DeviceMotionData();
- DeviceMotionData(RefPtr<Acceleration>&&, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&&, bool canProvideInterval, double interval);
</del><ins>+ DeviceMotionData() = default;
+ DeviceMotionData(RefPtr<Acceleration>&&, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&&, std::optional<double> interval);
</ins><span class="cx">
</span><span class="cx"> RefPtr<Acceleration> m_acceleration;
</span><span class="cx"> RefPtr<Acceleration> m_accelerationIncludingGravity;
</span><span class="cx"> RefPtr<RotationRate> m_rotationRate;
</span><del>- bool m_canProvideInterval;
- double m_interval;
</del><ins>+ std::optional<double> 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& type, bool bubbles, bool cancelable, DeviceMotionData* deviceMotionData)
</del><ins>+static std::optional<DeviceMotionEvent::Acceleration> convert(const DeviceMotionData::Acceleration* acceleration)
</ins><span class="cx"> {
</span><ins>+ if (!acceleration)
+ return std::nullopt;
+
+ return DeviceMotionEvent::Acceleration { acceleration->x(), acceleration->y(), acceleration->z() };
+}
+
+static std::optional<DeviceMotionEvent::RotationRate> convert(const DeviceMotionData::RotationRate* rotationRate)
+{
+ if (!rotationRate)
+ return std::nullopt;
+
+ return DeviceMotionEvent::RotationRate { rotationRate->alpha(), rotationRate->beta(), rotationRate->gamma() };
+}
+
+static RefPtr<DeviceMotionData::Acceleration> convert(std::optional<DeviceMotionEvent::Acceleration>&& acceleration)
+{
+ if (!acceleration)
+ return nullptr;
+
+ if (!acceleration->x && !acceleration->y && !acceleration->z)
+ return nullptr;
+
+ return DeviceMotionData::Acceleration::create(acceleration->x, acceleration->y, acceleration->z);
+}
+
+static RefPtr<DeviceMotionData::RotationRate> convert(std::optional<DeviceMotionEvent::RotationRate>&& rotationRate)
+{
+ if (!rotationRate)
+ return nullptr;
+
+ if (!rotationRate->alpha && !rotationRate->beta && !rotationRate->gamma)
+ return nullptr;
+
+ return DeviceMotionData::RotationRate::create(rotationRate->alpha, rotationRate->beta, rotationRate->gamma);
+}
+
+std::optional<DeviceMotionEvent::Acceleration> DeviceMotionEvent::acceleration() const
+{
+ return convert(m_deviceMotionData->acceleration());
+}
+
+std::optional<DeviceMotionEvent::Acceleration> DeviceMotionEvent::accelerationIncludingGravity() const
+{
+ return convert(m_deviceMotionData->accelerationIncludingGravity());
+}
+
+std::optional<DeviceMotionEvent::RotationRate> DeviceMotionEvent::rotationRate() const
+{
+ return convert(m_deviceMotionData->rotationRate());
+}
+
+std::optional<double> DeviceMotionEvent::interval() const
+{
+ return m_deviceMotionData->interval();
+}
+
+void DeviceMotionEvent::initDeviceMotionEvent(const AtomicString& type, bool bubbles, bool cancelable, std::optional<DeviceMotionEvent::Acceleration>&& acceleration, std::optional<DeviceMotionEvent::Acceleration>&& accelerationIncludingGravity, std::optional<DeviceMotionEvent::RotationRate>&& rotationRate, std::optional<double> interval)
+{
</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<double> x;
+ std::optional<double> y;
+ std::optional<double> z;
+ };
+
+ // FIXME: Merge this with DeviceMotionData::RotationRate
+ struct RotationRate {
+ std::optional<double> alpha;
+ std::optional<double> beta;
+ std::optional<double> gamma;
+ };
+
</ins><span class="cx"> static Ref<DeviceMotionEvent> create(const AtomicString& 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& type, bool bubbles, bool cancelable, DeviceMotionData*);
</del><ins>+ std::optional<Acceleration> acceleration() const;
+ std::optional<Acceleration> accelerationIncludingGravity() const;
+ std::optional<RotationRate> rotationRate() const;
+ std::optional<double> interval() const;
</ins><span class="cx">
</span><del>- DeviceMotionData* deviceMotionData() const { return m_deviceMotionData.get(); }
</del><ins>+ void initDeviceMotionEvent(const AtomicString& type, bool bubbles, bool cancelable, std::optional<Acceleration>&&, std::optional<Acceleration>&&, std::optional<RotationRate>&&, std::optional<double>);
</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& eventType, DeviceMotionData*);
</span><span class="cx">
</span><ins>+ EventInterface eventInterface() const override;
+
</ins><span class="cx"> RefPtr<DeviceMotionData> 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 = "",
+ 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<DeviceOrientationData> 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<DeviceOrientationData> 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<DeviceOrientationData> DeviceOrientationData::create(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<double> compassHeading, std::optional<double> 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<DeviceOrientationData> DeviceOrientationData::create(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma, bool canProvideAbsolute, bool absolute)
-{
- return adoptRef(*new DeviceOrientationData(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma, canProvideAbsolute, absolute));
-}
-#endif
</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<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<double> compassHeading, std::optional<double> 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<DeviceOrientationData> DeviceOrientationData::create(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<bool> 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<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<bool> absolute)
+ : m_alpha(alpha)
+ , m_beta(beta)
+ , m_gamma(gamma)
+ , m_absolute(absolute)
</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 "PlatformExportMacros.h"
</span><ins>+#include <wtf/Optional.h>
</ins><span class="cx"> #include <wtf/Ref.h>
</span><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="cx">
</span><span class="lines">@@ -33,54 +34,43 @@
</span><span class="cx">
</span><span class="cx"> class DeviceOrientationData : public RefCounted<DeviceOrientationData> {
</span><span class="cx"> public:
</span><del>- static Ref<DeviceOrientationData> create();
</del><ins>+ static Ref<DeviceOrientationData> create()
+ {
+ return adoptRef(*new DeviceOrientationData);
+ }
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><del>- WEBCORE_EXPORT static Ref<DeviceOrientationData> create(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma, bool canProvideCompassHeading, double compassHeading, bool canProvideCompassAccuracy, double compassAccuracy);
</del><ins>+ WEBCORE_EXPORT static Ref<DeviceOrientationData> create(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<double> compassHeading, std::optional<double> compassAccuracy);
</ins><span class="cx"> #else
</span><del>- WEBCORE_EXPORT static Ref<DeviceOrientationData> 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<DeviceOrientationData> create(std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<bool> 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<double> alpha() const { return m_alpha; }
+ std::optional<double> beta() const { return m_beta; }
+ std::optional<double> 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<double> compassHeading() const { return m_compassHeading; }
+ std::optional<double> compassAccuracy() const { return m_compassAccuracy; }
+#else
+ std::optional<bool> 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<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<double> compassHeading, std::optional<double> 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<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<bool> 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<double> m_alpha;
+ std::optional<double> m_beta;
+ std::optional<double> 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<double> m_compassHeading;
+ std::optional<double> m_compassAccuracy;
</ins><span class="cx"> #else
</span><del>- bool m_absolute;
</del><ins>+ std::optional<bool> 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& type, bool bubbles, bool cancelable, DeviceOrientationData* orientation)
</del><ins>+std::optional<double> DeviceOrientationEvent::alpha() const
</ins><span class="cx"> {
</span><ins>+ return m_orientation->alpha();
+}
+
+std::optional<double> DeviceOrientationEvent::beta() const
+{
+ return m_orientation->beta();
+}
+
+std::optional<double> DeviceOrientationEvent::gamma() const
+{
+ return m_orientation->gamma();
+}
+
+#if PLATFORM(IOS)
+
+std::optional<double> DeviceOrientationEvent::compassHeading() const
+{
+ return m_orientation->compassHeading();
+}
+
+std::optional<double> DeviceOrientationEvent::compassAccuracy() const
+{
+ return m_orientation->compassAccuracy();
+}
+
+void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<double> compassHeading, std::optional<double> compassAccuracy)
+{
</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<bool> DeviceOrientationEvent::absolute() const
+{
+ return m_orientation->absolute();
+}
+
+void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<bool> absolute)
+{
+ if (dispatched())
+ return;
+
+ initEvent(type, bubbles, cancelable);
+ m_orientation = DeviceOrientationData::create(alpha, beta, gamma, absolute);
+}
+
+#endif
+
</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<DeviceOrientationEvent> create(const AtomicString& 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& 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<double> alpha() const;
+ std::optional<double> beta() const;
+ std::optional<double> gamma() const;
</ins><span class="cx">
</span><del>- EventInterface eventInterface() const override;
</del><ins>+#if PLATFORM(IOS)
+ std::optional<double> compassHeading() const;
+ std::optional<double> compassAccuracy() const;
</ins><span class="cx">
</span><ins>+ void initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<double> compassHeading, std::optional<double> compassAccuracy);
+#else
+ std::optional<bool> absolute() const;
+
+ void initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, std::optional<double> alpha, std::optional<double> beta, std::optional<double> gamma, std::optional<bool> absolute);
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx"> DeviceOrientationEvent();
</span><span class="cx"> DeviceOrientationEvent(const AtomicString& eventType, DeviceOrientationData*);
</span><span class="cx">
</span><ins>+ EventInterface eventInterface() const override;
+
</ins><span class="cx"> RefPtr<DeviceOrientationData> 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) && 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 = "",
+ 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 = "",
+ 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<DeviceMotionData::Acceleration> accelerationIncludingGravity = DeviceMotionData::Acceleration::create(false, 0,
- false, 0,
- false, 0);
- RefPtr<DeviceMotionData::Acceleration> acceleration = DeviceMotionData::Acceleration::create(false, 0,
- false, 0,
- false, 0);
- RefPtr<DeviceMotionData::RotationRate> rotationRate = DeviceMotionData::RotationRate::create(false, 0,
- false, 0,
- false, 0);
</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<DeviceMotionData::Acceleration> accelerationIncludingGravity = DeviceMotionData::Acceleration::create(true, xAccelerationIncludingGravity,
- true, yAccelerationIncludingGravity,
- true, zAccelerationIncludingGravity);
- RefPtr<DeviceMotionData::Acceleration> acceleration = 0;
- RefPtr<DeviceMotionData::RotationRate> rotationRate = 0;
</del><ins>+ auto accelerationIncludingGravity = DeviceMotionData::Acceleration::create(xAccelerationIncludingGravity, yAccelerationIncludingGravity, zAccelerationIncludingGravity);
+
+ RefPtr<DeviceMotionData::Acceleration> acceleration;
+ RefPtr<DeviceMotionData::RotationRate> 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->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->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 <sam@webkit.org>
+
+ [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 <pecoraro@apple.com>
</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->m_internal->m_orientation.get() : 0;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static std::optional<double> 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>