[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
atwilson at chromium.org
atwilson at chromium.org
Wed Dec 22 13:42:50 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 41d4bb42aa8ec4274adb78c07dfc05027f0461d5
Author: atwilson at chromium.org <atwilson at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Sep 23 22:03:23 2010 +0000
Revert "2010-09-23 Hans Wennborg <hans at chromium.org>"
Revert r68197 because it breaks the chromium linux build.
https://bugs.webkit.org/show_bug.cgi?id=46344
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index ca3a234..bfa12d3 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-09-23 Andrew Wilson <atwilson at chromium.org>
+
+ Unreviewed, rolling out r68197.
+ http://trac.webkit.org/changeset/68197
+ https://bugs.webkit.org/show_bug.cgi?id=46344
+
+ Breaks
+
+ * fast/dom/DeviceMotion/create-event-expected.txt:
+ * fast/dom/DeviceMotion/optional-event-properties-expected.txt:
+ * fast/dom/DeviceMotion/script-tests/create-event.js:
+ * fast/dom/DeviceMotion/script-tests/optional-event-properties.js:
+ * fast/dom/script-tests/prototype-inheritance.js:
+
2010-09-22 Dirk Pranke <dpranke at chromium.org>
Unreviewed, expectations change.
diff --git a/LayoutTests/fast/dom/DeviceMotion/create-event-expected.txt b/LayoutTests/fast/dom/DeviceMotion/create-event-expected.txt
index c59edba..fdc40c4 100644
--- a/LayoutTests/fast/dom/DeviceMotion/create-event-expected.txt
+++ b/LayoutTests/fast/dom/DeviceMotion/create-event-expected.txt
@@ -7,17 +7,24 @@ PASS typeof event == 'object' is true
PASS 'type' in event is true
PASS 'bubbles' in event is true
PASS 'cancelable' in event is true
-PASS 'acceleration' in event is true
-PASS 'accelerationIncludingGravity' in event is true
-PASS 'rotationRate' in event is true
+PASS 'xAcceleration' in event is true
+PASS 'yAcceleration' in event is true
+PASS 'zAcceleration' in event is true
+PASS 'xRotationRate' in event is true
+PASS 'yRotationRate' in event is true
+PASS 'zRotationRate' in event is true
PASS 'interval' in event is true
PASS typeof event.type == 'string' is true
PASS typeof event.bubbles == 'boolean' is true
PASS typeof event.cancelable == 'boolean' is true
-PASS typeof event.acceleration == 'object' is true
-PASS typeof event.accelerationIncludingGravity == 'object' is true
-PASS typeof event.rotationRate == 'object' is true
+PASS typeof event.xAcceleration == 'object' is true
+PASS typeof event.yAcceleration == 'object' is true
+PASS typeof event.zAcceleration == 'object' is true
+PASS typeof event.xRotationRate == 'object' is true
+PASS typeof event.yRotationRate == 'object' is true
+PASS typeof event.zRotationRate == 'object' is true
PASS typeof event.interval == 'object' is true
PASS successfullyParsed is true
TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/DeviceMotion/optional-event-properties-expected.txt b/LayoutTests/fast/dom/DeviceMotion/optional-event-properties-expected.txt
index e00875e..0eabe35 100644
--- a/LayoutTests/fast/dom/DeviceMotion/optional-event-properties-expected.txt
+++ b/LayoutTests/fast/dom/DeviceMotion/optional-event-properties-expected.txt
@@ -4,57 +4,62 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
event = document.createEvent('DeviceMotionEvent')
-PASS event.acceleration == null is true
-PASS event.accelerationIncludingGravity == null is true
-PASS event.rotationRate == null is true
+PASS event.xAcceleration == null is true
+PASS event.yAcceleration == null is true
+PASS event.zAcceleration == null is true
+PASS event.xRotationRate == null is true
+PASS event.yRotationRate == null is true
+PASS event.zRotationRate == null is true
PASS event.interval == null is true
-event.initDeviceMotionEvent('', false, false, {x: 0, y: 1, z: 2}, {x: 3, y: 4, z: 5}, {alpha: 6, beta: 7, gamma: 8}, 9)
-PASS event.acceleration.x == 0 is true
-PASS event.acceleration.y == 1 is true
-PASS event.acceleration.z == 2 is true
-PASS event.accelerationIncludingGravity.x == 3 is true
-PASS event.accelerationIncludingGravity.y == 4 is true
-PASS event.accelerationIncludingGravity.z == 5 is true
-PASS event.rotationRate.alpha == 6 is true
-PASS event.rotationRate.beta == 7 is true
-PASS event.rotationRate.gamma == 8 is true
-PASS event.interval == 9 is true
-event.initDeviceMotionEvent('', false, false, {y: 1, x: 0}, {x: 3, z: 5}, {gamma: 8, beta: 7}, 9)
-PASS event.acceleration.x == 0 is true
-PASS event.acceleration.y == 1 is true
-PASS event.acceleration.z == null is true
-PASS event.accelerationIncludingGravity.x == 3 is true
-PASS event.accelerationIncludingGravity.y == null is true
-PASS event.accelerationIncludingGravity.z == 5 is true
-PASS event.rotationRate.alpha == null is true
-PASS event.rotationRate.beta == 7 is true
-PASS event.rotationRate.gamma == 8 is true
-PASS event.interval == 9 is true
+event.initDeviceMotionEvent('', false, false, 0, 1, 2, 3, 4, 5, 6)
+PASS event.xAcceleration == 0 is true
+PASS event.yAcceleration == 1 is true
+PASS event.zAcceleration == 2 is true
+PASS event.xRotationRate == 3 is true
+PASS event.yRotationRate == 4 is true
+PASS event.zRotationRate == 5 is true
+PASS event.interval == 6 is true
event.initDeviceMotionEvent()
-PASS event.acceleration == null is true
-PASS event.accelerationIncludingGravity == null is true
-PASS event.rotationRate == null is true
+PASS event.xAcceleration == null is true
+PASS event.yAcceleration == null is true
+PASS event.zAcceleration == null is true
+PASS event.xRotationRate == null is true
+PASS event.yRotationRate == null is true
+PASS event.zRotationRate == null is true
PASS event.interval == null is true
event.initDeviceMotionEvent('', false, false, [], [], [], [], [], [], [])
-PASS event.acceleration == null is true
-PASS event.accelerationIncludingGravity == null is true
-PASS event.rotationRate == null is true
+PASS event.xAcceleration == 0 is true
+PASS event.yAcceleration == 0 is true
+PASS event.zAcceleration == 0 is true
+PASS event.xRotationRate == 0 is true
+PASS event.yRotationRate == 0 is true
+PASS event.zRotationRate == 0 is true
PASS event.interval == 0 is true
event.initDeviceMotionEvent('', false, false, undefined, undefined, undefined, undefined, undefined, undefined, undefined)
-PASS event.acceleration == null is true
-PASS event.accelerationIncludingGravity == null is true
-PASS event.rotationRate == null is true
+PASS event.xAcceleration == null is true
+PASS event.yAcceleration == null is true
+PASS event.zAcceleration == null is true
+PASS event.xRotationRate == null is true
+PASS event.yRotationRate == null is true
+PASS event.zRotationRate == null is true
PASS event.interval == null is true
event.initDeviceMotionEvent('', false, false, '', '', '', '', '', '', '')
-PASS event.acceleration == null is true
-PASS event.accelerationIncludingGravity == null is true
-PASS event.rotationRate == null is true
+PASS event.xAcceleration == 0 is true
+PASS event.yAcceleration == 0 is true
+PASS event.zAcceleration == 0 is true
+PASS event.xRotationRate == 0 is true
+PASS event.yRotationRate == 0 is true
+PASS event.zRotationRate == 0 is true
PASS event.interval == 0 is true
event.initDeviceMotionEvent('', false, false, null, null, null, null, null, null, null)
-PASS event.acceleration == null is true
-PASS event.accelerationIncludingGravity == null is true
-PASS event.rotationRate == null is true
+PASS event.xAcceleration == null is true
+PASS event.yAcceleration == null is true
+PASS event.zAcceleration == null is true
+PASS event.xRotationRate == null is true
+PASS event.yRotationRate == null is true
+PASS event.zRotationRate == null is true
PASS event.interval == null is true
PASS successfullyParsed is true
TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/DeviceMotion/script-tests/create-event.js b/LayoutTests/fast/dom/DeviceMotion/script-tests/create-event.js
index 8b5aec8..167329d 100644
--- a/LayoutTests/fast/dom/DeviceMotion/script-tests/create-event.js
+++ b/LayoutTests/fast/dom/DeviceMotion/script-tests/create-event.js
@@ -7,17 +7,23 @@ shouldBeTrue("typeof event == 'object'");
shouldBeTrue("'type' in event");
shouldBeTrue("'bubbles' in event");
shouldBeTrue("'cancelable' in event");
-shouldBeTrue("'acceleration' in event");
-shouldBeTrue("'accelerationIncludingGravity' in event");
-shouldBeTrue("'rotationRate' in event");
+shouldBeTrue("'xAcceleration' in event");
+shouldBeTrue("'yAcceleration' in event");
+shouldBeTrue("'zAcceleration' in event");
+shouldBeTrue("'xRotationRate' in event");
+shouldBeTrue("'yRotationRate' in event");
+shouldBeTrue("'zRotationRate' in event");
shouldBeTrue("'interval' in event");
shouldBeTrue("typeof event.type == 'string'");
shouldBeTrue("typeof event.bubbles == 'boolean'");
shouldBeTrue("typeof event.cancelable == 'boolean'");
-shouldBeTrue("typeof event.acceleration == 'object'");
-shouldBeTrue("typeof event.accelerationIncludingGravity == 'object'");
-shouldBeTrue("typeof event.rotationRate == 'object'");
+shouldBeTrue("typeof event.xAcceleration == 'object'");
+shouldBeTrue("typeof event.yAcceleration == 'object'");
+shouldBeTrue("typeof event.zAcceleration == 'object'");
+shouldBeTrue("typeof event.xRotationRate == 'object'");
+shouldBeTrue("typeof event.yRotationRate == 'object'");
+shouldBeTrue("typeof event.zRotationRate == 'object'");
shouldBeTrue("typeof event.interval == 'object'");
window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/DeviceMotion/script-tests/optional-event-properties.js b/LayoutTests/fast/dom/DeviceMotion/script-tests/optional-event-properties.js
index c4fc5cb..ab9b53b 100644
--- a/LayoutTests/fast/dom/DeviceMotion/script-tests/optional-event-properties.js
+++ b/LayoutTests/fast/dom/DeviceMotion/script-tests/optional-event-properties.js
@@ -3,63 +3,66 @@ description("Tests the optional properties of DeviceMotionEvent. Each property s
var event;
evalAndLog("event = document.createEvent('DeviceMotionEvent')");
-shouldBeTrue("event.acceleration == null");
-shouldBeTrue("event.accelerationIncludingGravity == null");
-shouldBeTrue("event.rotationRate == null");
+shouldBeTrue("event.xAcceleration == null");
+shouldBeTrue("event.yAcceleration == null");
+shouldBeTrue("event.zAcceleration == null");
+shouldBeTrue("event.xRotationRate == null");
+shouldBeTrue("event.yRotationRate == null");
+shouldBeTrue("event.zRotationRate == null");
shouldBeTrue("event.interval == null");
-evalAndLog("event.initDeviceMotionEvent('', false, false, {x: 0, y: 1, z: 2}, {x: 3, y: 4, z: 5}, {alpha: 6, beta: 7, gamma: 8}, 9)");
-shouldBeTrue("event.acceleration.x == 0");
-shouldBeTrue("event.acceleration.y == 1");
-shouldBeTrue("event.acceleration.z == 2");
-shouldBeTrue("event.accelerationIncludingGravity.x == 3");
-shouldBeTrue("event.accelerationIncludingGravity.y == 4");
-shouldBeTrue("event.accelerationIncludingGravity.z == 5");
-shouldBeTrue("event.rotationRate.alpha == 6");
-shouldBeTrue("event.rotationRate.beta == 7");
-shouldBeTrue("event.rotationRate.gamma == 8");
-shouldBeTrue("event.interval == 9");
-
-evalAndLog("event.initDeviceMotionEvent('', false, false, {y: 1, x: 0}, {x: 3, z: 5}, {gamma: 8, beta: 7}, 9)");
-shouldBeTrue("event.acceleration.x == 0");
-shouldBeTrue("event.acceleration.y == 1");
-shouldBeTrue("event.acceleration.z == null");
-shouldBeTrue("event.accelerationIncludingGravity.x == 3");
-shouldBeTrue("event.accelerationIncludingGravity.y == null");
-shouldBeTrue("event.accelerationIncludingGravity.z == 5");
-shouldBeTrue("event.rotationRate.alpha == null");
-shouldBeTrue("event.rotationRate.beta == 7");
-shouldBeTrue("event.rotationRate.gamma == 8");
-shouldBeTrue("event.interval == 9");
+evalAndLog("event.initDeviceMotionEvent('', false, false, 0, 1, 2, 3, 4, 5, 6)");
+shouldBeTrue("event.xAcceleration == 0");
+shouldBeTrue("event.yAcceleration == 1");
+shouldBeTrue("event.zAcceleration == 2");
+shouldBeTrue("event.xRotationRate == 3");
+shouldBeTrue("event.yRotationRate == 4");
+shouldBeTrue("event.zRotationRate == 5");
+shouldBeTrue("event.interval == 6");
evalAndLog("event.initDeviceMotionEvent()");
-shouldBeTrue("event.acceleration == null");
-shouldBeTrue("event.accelerationIncludingGravity == null");
-shouldBeTrue("event.rotationRate == null");
+shouldBeTrue("event.xAcceleration == null");
+shouldBeTrue("event.yAcceleration == null");
+shouldBeTrue("event.zAcceleration == null");
+shouldBeTrue("event.xRotationRate == null");
+shouldBeTrue("event.yRotationRate == null");
+shouldBeTrue("event.zRotationRate == null");
shouldBeTrue("event.interval == null");
evalAndLog("event.initDeviceMotionEvent('', false, false, [], [], [], [], [], [], [])");
-shouldBeTrue("event.acceleration == null");
-shouldBeTrue("event.accelerationIncludingGravity == null");
-shouldBeTrue("event.rotationRate == null");
+shouldBeTrue("event.xAcceleration == 0");
+shouldBeTrue("event.yAcceleration == 0");
+shouldBeTrue("event.zAcceleration == 0");
+shouldBeTrue("event.xRotationRate == 0");
+shouldBeTrue("event.yRotationRate == 0");
+shouldBeTrue("event.zRotationRate == 0");
shouldBeTrue("event.interval == 0");
evalAndLog("event.initDeviceMotionEvent('', false, false, undefined, undefined, undefined, undefined, undefined, undefined, undefined)");
-shouldBeTrue("event.acceleration == null");
-shouldBeTrue("event.accelerationIncludingGravity == null");
-shouldBeTrue("event.rotationRate == null");
+shouldBeTrue("event.xAcceleration == null");
+shouldBeTrue("event.yAcceleration == null");
+shouldBeTrue("event.zAcceleration == null");
+shouldBeTrue("event.xRotationRate == null");
+shouldBeTrue("event.yRotationRate == null");
+shouldBeTrue("event.zRotationRate == null");
shouldBeTrue("event.interval == null");
evalAndLog("event.initDeviceMotionEvent('', false, false, '', '', '', '', '', '', '')");
-shouldBeTrue("event.acceleration == null");
-shouldBeTrue("event.accelerationIncludingGravity == null");
-shouldBeTrue("event.rotationRate == null");
+shouldBeTrue("event.xAcceleration == 0");
+shouldBeTrue("event.yAcceleration == 0");
+shouldBeTrue("event.zAcceleration == 0");
+shouldBeTrue("event.xRotationRate == 0");
+shouldBeTrue("event.yRotationRate == 0");
+shouldBeTrue("event.zRotationRate == 0");
shouldBeTrue("event.interval == 0");
evalAndLog("event.initDeviceMotionEvent('', false, false, null, null, null, null, null, null, null)");
-shouldBeTrue("event.acceleration == null");
-shouldBeTrue("event.accelerationIncludingGravity == null");
-shouldBeTrue("event.rotationRate == null");
+shouldBeTrue("event.xAcceleration == null");
+shouldBeTrue("event.yAcceleration == null");
+shouldBeTrue("event.zAcceleration == null");
+shouldBeTrue("event.xRotationRate == null");
+shouldBeTrue("event.yRotationRate == null");
+shouldBeTrue("event.zRotationRate == null");
shouldBeTrue("event.interval == null");
window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/script-tests/prototype-inheritance.js b/LayoutTests/fast/dom/script-tests/prototype-inheritance.js
index 2a7c624..0d3615e 100644
--- a/LayoutTests/fast/dom/script-tests/prototype-inheritance.js
+++ b/LayoutTests/fast/dom/script-tests/prototype-inheritance.js
@@ -23,7 +23,6 @@ var skippedProperties = [
"showModalDialog",
"createBlobURL", "revokeBlobURL",
"DeviceOrientationEvent",
- "DeviceMotionEvent",
"TEMPORARY", "PERSISTENT",
"Flags",
// Ignore this property because it only appears in debug builds.
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f6d8e48..84faae2 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,46 @@
+2010-09-23 Andrew Wilson <atwilson at chromium.org>
+
+ Unreviewed, rolling out r68197.
+ http://trac.webkit.org/changeset/68197
+ https://bugs.webkit.org/show_bug.cgi?id=46344
+
+ Breaks
+
+ * WebCore.exp.in:
+ * bindings/js/JSDeviceMotionEventCustom.cpp:
+ (WebCore::JSDeviceMotionEvent::xAcceleration):
+ (WebCore::JSDeviceMotionEvent::yAcceleration):
+ (WebCore::JSDeviceMotionEvent::zAcceleration):
+ (WebCore::JSDeviceMotionEvent::xRotationRate):
+ (WebCore::JSDeviceMotionEvent::yRotationRate):
+ (WebCore::JSDeviceMotionEvent::zRotationRate):
+ (WebCore::JSDeviceMotionEvent::initDeviceMotionEvent):
+ * bindings/v8/custom/V8DeviceMotionEventCustom.cpp:
+ (WebCore::V8DeviceMotionEvent::xAccelerationAccessorGetter):
+ (WebCore::V8DeviceMotionEvent::yAccelerationAccessorGetter):
+ (WebCore::V8DeviceMotionEvent::zAccelerationAccessorGetter):
+ (WebCore::V8DeviceMotionEvent::xRotationRateAccessorGetter):
+ (WebCore::V8DeviceMotionEvent::yRotationRateAccessorGetter):
+ (WebCore::V8DeviceMotionEvent::zRotationRateAccessorGetter):
+ (WebCore::V8DeviceMotionEvent::initDeviceMotionEventCallback):
+ * dom/DeviceMotionData.cpp:
+ (WebCore::DeviceMotionData::create):
+ (WebCore::DeviceMotionData::DeviceMotionData):
+ * dom/DeviceMotionData.h:
+ (WebCore::DeviceMotionData::xAcceleration):
+ (WebCore::DeviceMotionData::yAcceleration):
+ (WebCore::DeviceMotionData::zAcceleration):
+ (WebCore::DeviceMotionData::xRotationRate):
+ (WebCore::DeviceMotionData::yRotationRate):
+ (WebCore::DeviceMotionData::zRotationRate):
+ (WebCore::DeviceMotionData::canProvideXAcceleration):
+ (WebCore::DeviceMotionData::canProvideYAcceleration):
+ (WebCore::DeviceMotionData::canProvideZAcceleration):
+ (WebCore::DeviceMotionData::canProvideXRotationRate):
+ (WebCore::DeviceMotionData::canProvideYRotationRate):
+ (WebCore::DeviceMotionData::canProvideZRotationRate):
+ * dom/DeviceMotionEvent.idl:
+
2010-09-23 David Hyatt <hyatt at apple.com>
Reviewed by Adele Peterson.
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index 26e3b68..e316fc2 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -360,9 +360,7 @@ __ZN7WebCore15VisiblePositionC1ERKNS_8PositionENS_9EAffinityE
__ZN7WebCore15reportExceptionEPN3JSC9ExecStateENS0_7JSValueE
__ZN7WebCore15visitedLinkHashEPKtj
__ZN7WebCore16AbstractDatabase14setIsAvailableEb
-__ZN7WebCore16DeviceMotionData12Acceleration6createEbdbdbd
-__ZN7WebCore16DeviceMotionData12RotationRate6createEbdbdbd
-__ZN7WebCore16DeviceMotionData6createEN3WTF10PassRefPtrINS0_12AccelerationEEES4_NS2_INS0_12RotationRateEEEbd
+__ZN7WebCore16DeviceMotionData6createEbdbdbdbdbdbdbd
__ZN7WebCore16FontFallbackList15releaseFontDataEv
__ZN7WebCore16FontPlatformDataC1EP6NSFontbb
__ZN7WebCore16FontPlatformDataD1Ev
diff --git a/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp b/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp
index 07a3019..225a626 100644
--- a/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp
+++ b/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp
@@ -35,124 +35,54 @@ using namespace JSC;
namespace WebCore {
-static PassRefPtr<DeviceMotionData::Acceleration> readAccelerationArgument(JSValue value, ExecState* exec)
+JSValue JSDeviceMotionEvent::xAcceleration(ExecState* exec) const
{
- if (value.isUndefinedOrNull())
- return 0;
-
- // Given the above test, this will always yield an object.
- JSObject* object = value.toObject(exec);
-
- JSValue xValue = object->get(exec, Identifier(exec, "x"));
- if (exec->hadException())
- return 0;
- bool canProvideX = !xValue.isUndefined();
- double x = xValue.toNumber(exec);
- if (exec->hadException())
- return 0;
-
- JSValue yValue = object->get(exec, Identifier(exec, "y"));
- if (exec->hadException())
- return 0;
- bool canProvideY = !yValue.isUndefined();
- double y = yValue.toNumber(exec);
- if (exec->hadException())
- return 0;
-
- JSValue zValue = object->get(exec, Identifier(exec, "z"));
- if (exec->hadException())
- return 0;
- bool canProvideZ = !zValue.isUndefined();
- double z = zValue.toNumber(exec);
- if (exec->hadException())
- return 0;
-
- if (!canProvideX && !canProvideY && !canProvideZ)
- return 0;
-
- return DeviceMotionData::Acceleration::create(canProvideX, x, canProvideY, y, canProvideZ, z);
-}
-
-static PassRefPtr<DeviceMotionData::RotationRate> readRotationRateArgument(JSValue value, ExecState* exec)
-{
- if (value.isUndefinedOrNull())
- return 0;
-
- // Given the above test, this will always yield an object.
- JSObject* object = value.toObject(exec);
-
- JSValue alphaValue = object->get(exec, Identifier(exec, "alpha"));
- if (exec->hadException())
- return 0;
- bool canProvideAlpha = !alphaValue.isUndefined();
- double alpha = alphaValue.toNumber(exec);
- if (exec->hadException())
- return 0;
-
- JSValue betaValue = object->get(exec, Identifier(exec, "beta"));
- if (exec->hadException())
- return 0;
- bool canProvideBeta = !betaValue.isUndefined();
- double beta = betaValue.toNumber(exec);
- if (exec->hadException())
- return 0;
-
- JSValue gammaValue = object->get(exec, Identifier(exec, "gamma"));
- if (exec->hadException())
- return 0;
- bool canProvideGamma = !gammaValue.isUndefined();
- double gamma = gammaValue.toNumber(exec);
- if (exec->hadException())
- return 0;
-
- if (!canProvideAlpha && !canProvideBeta && !canProvideGamma)
- return 0;
-
- return DeviceMotionData::RotationRate::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma);
+ DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
+ if (!imp->deviceMotionData()->canProvideXAcceleration())
+ return jsNull();
+ return jsNumber(exec, imp->deviceMotionData()->xAcceleration());
}
-static JSObject* createAccelerationObject(const DeviceMotionData::Acceleration* acceleration, ExecState* exec)
+JSValue JSDeviceMotionEvent::yAcceleration(ExecState* exec) const
{
- JSObject* object = constructEmptyObject(exec);
- object->putDirect(Identifier(exec, "x"), acceleration->canProvideX() ? jsNumber(exec, acceleration->x()) : jsNull());
- object->putDirect(Identifier(exec, "y"), acceleration->canProvideY() ? jsNumber(exec, acceleration->y()) : jsNull());
- object->putDirect(Identifier(exec, "z"), acceleration->canProvideZ() ? jsNumber(exec, acceleration->z()) : jsNull());
- return object;
+ DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
+ if (!imp->deviceMotionData()->canProvideYAcceleration())
+ return jsNull();
+ return jsNumber(exec, imp->deviceMotionData()->yAcceleration());
}
-static JSObject* createRotationRateObject(const DeviceMotionData::RotationRate* rotationRate, ExecState* exec)
+JSValue JSDeviceMotionEvent::zAcceleration(ExecState* exec) const
{
- JSObject* object = constructEmptyObject(exec);
- object->putDirect(Identifier(exec, "alpha"), rotationRate->canProvideAlpha() ? jsNumber(exec, rotationRate->alpha()) : jsNull());
- object->putDirect(Identifier(exec, "beta"), rotationRate->canProvideBeta() ? jsNumber(exec, rotationRate->beta()) : jsNull());
- object->putDirect(Identifier(exec, "gamma"), rotationRate->canProvideGamma() ? jsNumber(exec, rotationRate->gamma()) : jsNull());
- return object;
+ DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
+ if (!imp->deviceMotionData()->canProvideZAcceleration())
+ return jsNull();
+ return jsNumber(exec, imp->deviceMotionData()->zAcceleration());
}
-JSValue JSDeviceMotionEvent::acceleration(ExecState* exec) const
+JSValue JSDeviceMotionEvent::xRotationRate(ExecState* exec) const
{
DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
- if (!imp->deviceMotionData()->acceleration())
+ if (!imp->deviceMotionData()->canProvideXRotationRate())
return jsNull();
- return createAccelerationObject(imp->deviceMotionData()->acceleration(), exec);
+ return jsNumber(exec, imp->deviceMotionData()->xRotationRate());
}
-JSValue JSDeviceMotionEvent::accelerationIncludingGravity(ExecState* exec) const
+JSValue JSDeviceMotionEvent::yRotationRate(ExecState* exec) const
{
DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
- if (!imp->deviceMotionData()->accelerationIncludingGravity())
+ if (!imp->deviceMotionData()->canProvideYRotationRate())
return jsNull();
- return createAccelerationObject(imp->deviceMotionData()->accelerationIncludingGravity(), exec);
+ return jsNumber(exec, imp->deviceMotionData()->yRotationRate());
}
-JSValue JSDeviceMotionEvent::rotationRate(ExecState* exec) const
+JSValue JSDeviceMotionEvent::zRotationRate(ExecState* exec) const
{
DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
- if (!imp->deviceMotionData()->rotationRate())
+ if (!imp->deviceMotionData()->canProvideZRotationRate())
return jsNull();
- return createRotationRateObject(imp->deviceMotionData()->rotationRate(), exec);
+ return jsNumber(exec, imp->deviceMotionData()->zRotationRate());
}
-
+
JSValue JSDeviceMotionEvent::interval(ExecState* exec) const
{
DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
@@ -160,32 +90,34 @@ JSValue JSDeviceMotionEvent::interval(ExecState* exec) const
return jsNull();
return jsNumber(exec, imp->deviceMotionData()->interval());
}
-
+
JSValue JSDeviceMotionEvent::initDeviceMotionEvent(ExecState* exec)
{
const String& type = ustringToString(exec->argument(0).toString(exec));
bool bubbles = exec->argument(1).toBoolean(exec);
bool cancelable = exec->argument(2).toBoolean(exec);
- //
// 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(exec->argument(3), exec);
- if (exec->hadException())
- return jsUndefined();
-
- RefPtr<DeviceMotionData::Acceleration> accelerationIncludingGravity = readAccelerationArgument(exec->argument(4), exec);
- if (exec->hadException())
- return jsUndefined();
-
- RefPtr<DeviceMotionData::RotationRate> rotationRate = readRotationRateArgument(exec->argument(5), exec);
- if (exec->hadException())
- return jsUndefined();
-
- bool intervalProvided = !exec->argument(6).isUndefinedOrNull();
- double interval = exec->argument(6).toNumber(exec);
- RefPtr<DeviceMotionData> deviceMotionData = DeviceMotionData::create(acceleration,
- accelerationIncludingGravity,
- rotationRate,
+ bool xAccelerationProvided = !exec->argument(3).isUndefinedOrNull();
+ double xAcceleration = exec->argument(3).toNumber(exec);
+ bool yAccelerationProvided = !exec->argument(4).isUndefinedOrNull();
+ double yAcceleration = exec->argument(4).toNumber(exec);
+ bool zAccelerationProvided = !exec->argument(5).isUndefinedOrNull();
+ double zAcceleration = exec->argument(5).toNumber(exec);
+ bool xRotationRateProvided = !exec->argument(6).isUndefinedOrNull();
+ double xRotationRate = exec->argument(6).toNumber(exec);
+ bool yRotationRateProvided = !exec->argument(7).isUndefinedOrNull();
+ double yRotationRate = exec->argument(7).toNumber(exec);
+ bool zRotationRateProvided = !exec->argument(8).isUndefinedOrNull();
+ double zRotationRate = exec->argument(8).toNumber(exec);
+ bool intervalProvided = !exec->argument(9).isUndefinedOrNull();
+ double interval = exec->argument(9).toNumber(exec);
+ RefPtr<DeviceMotionData> deviceMotionData = DeviceMotionData::create(xAccelerationProvided, xAcceleration,
+ yAccelerationProvided, yAcceleration,
+ zAccelerationProvided, zAcceleration,
+ xRotationRateProvided, xRotationRate,
+ yRotationRateProvided, yRotationRate,
+ zRotationRateProvided, zRotationRate,
intervalProvided, interval);
DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
imp->initDeviceMotionEvent(type, bubbles, cancelable, deviceMotionData.get());
diff --git a/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp b/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp
index 86e46b7..67f27c5 100644
--- a/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp
@@ -37,110 +37,67 @@
namespace WebCore {
-namespace {
-
-v8::Handle<v8::Value> createAccelerationObject(PassRefPtr<DeviceMotionData::Acceleration> acceleration)
-{
- v8::Local<v8::Object> object = v8::Object::New();
- object->Set(v8::String::New("x"), acceleration->canProvideX() ? v8::Number::New(acceleration->x()) : v8::Null());
- object->Set(v8::String::New("y"), acceleration->canProvideY() ? v8::Number::New(acceleration->y()) : v8::Null());
- object->Set(v8::String::New("z"), acceleration->canProvideZ() ? v8::Number::New(acceleration->z()) : v8::Null());
- return object;
-}
-
-v8::Handle<v8::Value> createRotationRateObject(PassRefPtr<DeviceMotionData::RotationRate> rotationRate)
+v8::Handle<v8::Value> V8DeviceMotionEvent::xAccelerationAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- v8::Local<v8::Object> object = v8::Object::New();
- object->Set(v8::String::New("alpha"), rotationRate->canProvideAlpha() ? v8::Number::New(rotationRate->alpha()) : v8::Null());
- object->Set(v8::String::New("beta"), rotationRate->canProvideBeta() ? v8::Number::New(rotationRate->beta()) : v8::Null());
- object->Set(v8::String::New("gamma"), rotationRate->canProvideGamma() ? v8::Number::New(rotationRate->gamma()) : v8::Null());
- return object;
+ INC_STATS("DOM.DeviceMotionEvent.xAcceleration._get");
+ v8::Handle<v8::Object> holder = info.Holder();
+ DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder);
+ if (!imp->deviceMotionData()->canProvideXAcceleration())
+ return v8::Null();
+ return v8::Number::New(imp->deviceMotionData()->xAcceleration());
}
-RefPtr<DeviceMotionData::Acceleration> readAccelerationArgument(v8::Local<v8::Value> value)
+v8::Handle<v8::Value> V8DeviceMotionEvent::yAccelerationAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- if (isUndefinedOrNull(value))
- return 0;
-
- // Given the test above, this will always yield an object.
- v8::Local<v8::Object> object = value->ToObject();
-
- v8::Local<v8::Value> xValue = object->Get(v8::String::New("x"));
- bool canProvideX = !isUndefinedOrNull(xValue);
- double x = static_cast<double>(xValue->NumberValue());
-
- v8::Local<v8::Value> yValue = object->Get(v8::String::New("y"));
- bool canProvideY = !isUndefinedOrNull(yValue);
- double y = static_cast<double>(yValue->NumberValue());
-
- v8::Local<v8::Value> zValue = object->Get(v8::String::New("z"));
- bool canProvideZ = !isUndefinedOrNull(zValue);
- double z = static_cast<double>(zValue->NumberValue());
-
- if (!canProvideX && !canProvideY && !canProvideZ)
- return 0;
-
- return DeviceMotionData::Acceleration::create(canProvideX, x, canProvideY, y, canProvideZ, z);
+ INC_STATS("DOM.DeviceMotionEvent.yAcceleration._get");
+ v8::Handle<v8::Object> holder = info.Holder();
+ DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder);
+ if (!imp->deviceMotionData()->canProvideYAcceleration())
+ return v8::Null();
+ return v8::Number::New(imp->deviceMotionData()->yAcceleration());
}
-RefPtr<DeviceMotionData::RotationRate> readRotationRateArgument(v8::Local<v8::Value> value)
+v8::Handle<v8::Value> V8DeviceMotionEvent::zAccelerationAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- if (isUndefinedOrNull(value))
- return 0;
-
- // Given the test above, this will always yield an object.
- v8::Local<v8::Object> object = value->ToObject();
-
- v8::Local<v8::Value> alphaValue = object->Get(v8::String::New("alpha"));
- bool canProvideAlpha = !isUndefinedOrNull(alphaValue);
- double alpha = static_cast<double>(alphaValue->NumberValue());
-
- v8::Local<v8::Value> betaValue = object->Get(v8::String::New("beta"));
- bool canProvideBeta = !isUndefinedOrNull(betaValue);
- double beta = static_cast<double>(betaValue->NumberValue());
-
- v8::Local<v8::Value> gammaValue = object->Get(v8::String::New("gamma"));
- bool canProvideGamma = !isUndefinedOrNull(gammaValue);
- double gamma = static_cast<double>(gammaValue->NumberValue());
-
- if (!canProvideAlpha && !canProvideBeta && !canProvideGamma)
- return 0;
-
- return DeviceMotionData::RotationRate::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma);
+ INC_STATS("DOM.DeviceMotionEvent.zAcceleration._get");
+ v8::Handle<v8::Object> holder = info.Holder();
+ DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder);
+ if (!imp->deviceMotionData()->canProvideZAcceleration())
+ return v8::Null();
+ return v8::Number::New(imp->deviceMotionData()->zAcceleration());
}
-} // namespace
-
-v8::Handle<v8::Value> V8DeviceMotionEvent::accelerationAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+v8::Handle<v8::Value> V8DeviceMotionEvent::xRotationRateAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- INC_STATS("DOM.DeviceMotionEvent.acceleration._get");
+ INC_STATS("DOM.DeviceMotionEvent.xRotationRate._get");
v8::Handle<v8::Object> holder = info.Holder();
DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder);
- if (!imp->deviceMotionData()->acceleration())
+ if (!imp->deviceMotionData()->canProvideXRotationRate())
return v8::Null();
- return createAccelerationObject(imp->deviceMotionData()->acceleration());
+ return v8::Number::New(imp->deviceMotionData()->xRotationRate());
}
-v8::Handle<v8::Value> V8DeviceMotionEvent::accelerationIncludingGravityAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+v8::Handle<v8::Value> V8DeviceMotionEvent::yRotationRateAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- INC_STATS("DOM.DeviceMotionEvent.accelerationIncludingGravity._get");
+ INC_STATS("DOM.DeviceMotionEvent.yRotationRate._get");
v8::Handle<v8::Object> holder = info.Holder();
DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder);
- if (!imp->deviceMotionData()->accelerationIncludingGravity())
+ if (!imp->deviceMotionData()->canProvideYRotationRate())
return v8::Null();
- return createAccelerationObject(imp->deviceMotionData()->accelerationIncludingGravity());
+ return v8::Number::New(imp->deviceMotionData()->yRotationRate());
}
-v8::Handle<v8::Value> V8DeviceMotionEvent::rotationRateAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+v8::Handle<v8::Value> V8DeviceMotionEvent::zRotationRateAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
- INC_STATS("DOM.DeviceMotionEvent.rotationRate._get");
+ INC_STATS("DOM.DeviceMotionEvent.zRotationRate._get");
v8::Handle<v8::Object> holder = info.Holder();
DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder);
- if (!imp->deviceMotionData()->rotationRate())
+ if (!imp->deviceMotionData()->canProvideZRotationRate())
return v8::Null();
- return createRotationRateObject(imp->deviceMotionData()->rotationRate());
+ return v8::Number::New(imp->deviceMotionData()->zRotationRate());
}
+
v8::Handle<v8::Value> V8DeviceMotionEvent::intervalAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.DeviceMotionEvent.interval._get");
@@ -157,15 +114,23 @@ v8::Handle<v8::Value> V8DeviceMotionEvent::initDeviceMotionEventCallback(const v
STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, type, args[0]);
bool bubbles = args[1]->BooleanValue();
bool cancelable = args[2]->BooleanValue();
- RefPtr<DeviceMotionData::Acceleration> acceleration = readAccelerationArgument(args[3]);
- RefPtr<DeviceMotionData::Acceleration> accelerationIncludingGravity = readAccelerationArgument(args[4]);
- RefPtr<DeviceMotionData::RotationRate> rotationRate = readRotationRateArgument(args[5]);
- bool intervalProvided = !isUndefinedOrNull(args[6]);
- double interval = static_cast<double>(args[6]->NumberValue());
- RefPtr<DeviceMotionData> deviceMotionData = DeviceMotionData::create(acceleration,
- accelerationIncludingGravity,
- rotationRate,
- intervalProvided, interval);
+ // If any of the parameters are null or undefined, mark them as not provided.
+ // Otherwise, use the standard JavaScript conversion.
+ bool xAccelerationProvided = !isUndefinedOrNull(args[3]);
+ double xAcceleration = static_cast<double>(args[3]->NumberValue());
+ bool yAccelerationProvided = !isUndefinedOrNull(args[4]);
+ double yAcceleration = static_cast<double>(args[4]->NumberValue());
+ bool zAccelerationProvided = !isUndefinedOrNull(args[5]);
+ double zAcceleration = static_cast<double>(args[5]->NumberValue());
+ bool xRotationRateProvided = !isUndefinedOrNull(args[6]);
+ double xRotationRate = static_cast<double>(args[6]->NumberValue());
+ bool yRotationRateProvided = !isUndefinedOrNull(args[7]);
+ double yRotationRate = static_cast<double>(args[7]->NumberValue());
+ bool zRotationRateProvided = !isUndefinedOrNull(args[8]);
+ double zRotationRate = static_cast<double>(args[8]->NumberValue());
+ bool intervalProvided = !isUndefinedOrNull(args[9]);
+ double interval = static_cast<double>(args[9]->NumberValue());
+ RefPtr<DeviceMotionData> deviceMotionData = DeviceMotionData::create(xAccelerationProvided, xAcceleration, yAccelerationProvided, yAcceleration, zAccelerationProvided, zAcceleration, xRotationRateProvided, xRotationRate, yRotationRateProvided, yRotationRate, zRotationRateProvided, zRotationRate, intervalProvided, interval);
imp->initDeviceMotionEvent(type, bubbles, cancelable, deviceMotionData.get());
return v8::Handle<v8::Value>();
}
diff --git a/WebCore/dom/DeviceMotionData.cpp b/WebCore/dom/DeviceMotionData.cpp
index 2ad2448..cf4b466 100644
--- a/WebCore/dom/DeviceMotionData.cpp
+++ b/WebCore/dom/DeviceMotionData.cpp
@@ -28,71 +28,59 @@
namespace WebCore {
-PassRefPtr<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)
-
-{
-}
-
-PassRefPtr<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)
-{
-}
-
PassRefPtr<DeviceMotionData> DeviceMotionData::create()
{
return adoptRef(new DeviceMotionData);
}
-PassRefPtr<DeviceMotionData> DeviceMotionData::create(PassRefPtr<Acceleration> acceleration,
- PassRefPtr<Acceleration> accelerationIncludingGravity,
- PassRefPtr<RotationRate> rotationRate,
+PassRefPtr<DeviceMotionData> DeviceMotionData::create(bool canProvideXAcceleration, double xAcceleration,
+ bool canProvideYAcceleration, double yAcceleration,
+ bool canProvideZAcceleration, double zAcceleration,
+ bool canProvideXRotationRate, double xRotationRate,
+ bool canProvideYRotationRate, double yRotationRate,
+ bool canProvideZRotationRate, double zRotationRate,
bool canProvideInterval, double interval)
{
- return adoptRef(new DeviceMotionData(acceleration, accelerationIncludingGravity, rotationRate, canProvideInterval, interval));
+ return adoptRef(new DeviceMotionData(canProvideXAcceleration, xAcceleration,
+ canProvideYAcceleration, yAcceleration,
+ canProvideZAcceleration, zAcceleration,
+ canProvideXRotationRate, xRotationRate,
+ canProvideYRotationRate, yRotationRate,
+ canProvideZRotationRate, zRotationRate,
+ canProvideInterval, interval));
}
DeviceMotionData::DeviceMotionData()
- : m_canProvideInterval(false)
+ : m_canProvideXAcceleration(false)
+ , m_canProvideYAcceleration(false)
+ , m_canProvideZAcceleration(false)
+ , m_canProvideXRotationRate(false)
+ , m_canProvideYRotationRate(false)
+ , m_canProvideZRotationRate(false)
+ , m_canProvideInterval(false)
{
}
-DeviceMotionData::DeviceMotionData(PassRefPtr<Acceleration> acceleration,
- PassRefPtr<Acceleration> accelerationIncludingGravity,
- PassRefPtr<RotationRate> rotationRate,
+DeviceMotionData::DeviceMotionData(bool canProvideXAcceleration, double xAcceleration,
+ bool canProvideYAcceleration, double yAcceleration,
+ bool canProvideZAcceleration, double zAcceleration,
+ bool canProvideXRotationRate, double xRotationRate,
+ bool canProvideYRotationRate, double yRotationRate,
+ bool canProvideZRotationRate, double zRotationRate,
bool canProvideInterval, double interval)
- : m_acceleration(acceleration)
- , m_accelerationIncludingGravity(accelerationIncludingGravity)
- , m_rotationRate(rotationRate)
+ : m_canProvideXAcceleration(canProvideXAcceleration)
+ , m_canProvideYAcceleration(canProvideYAcceleration)
+ , m_canProvideZAcceleration(canProvideZAcceleration)
+ , m_canProvideXRotationRate(canProvideXRotationRate)
+ , m_canProvideYRotationRate(canProvideYRotationRate)
+ , m_canProvideZRotationRate(canProvideZRotationRate)
, m_canProvideInterval(canProvideInterval)
+ , m_xAcceleration(xAcceleration)
+ , m_yAcceleration(yAcceleration)
+ , m_zAcceleration(zAcceleration)
+ , m_xRotationRate(xRotationRate)
+ , m_yRotationRate(yRotationRate)
+ , m_zRotationRate(zRotationRate)
, m_interval(interval)
{
}
diff --git a/WebCore/dom/DeviceMotionData.h b/WebCore/dom/DeviceMotionData.h
index 4140c88..cd90246 100644
--- a/WebCore/dom/DeviceMotionData.h
+++ b/WebCore/dom/DeviceMotionData.h
@@ -28,91 +28,60 @@
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
namespace WebCore {
class DeviceMotionData : public RefCounted<DeviceMotionData> {
public:
- class Acceleration : public RefCounted<DeviceMotionData::Acceleration> {
- public:
- static PassRefPtr<Acceleration> create(bool canProvideX, double x,
- bool canProvideY, double y,
- bool canProvideZ, double z);
-
- bool canProvideX() const { return m_canProvideX; }
- bool canProvideY() const { return m_canProvideY; }
- bool canProvideZ() const { return m_canProvideZ; }
-
- double x() const { return m_x; }
- double y() const { return m_y; }
- double z() const { return m_z; }
-
- private:
- Acceleration(bool canProvideX, double x,
- bool canProvideY, double y,
- bool canProvideZ, double z);
-
- double m_x;
- double m_y;
- double m_z;
-
- bool m_canProvideX;
- bool m_canProvideY;
- bool m_canProvideZ;
- };
-
- class RotationRate : public RefCounted<DeviceMotionData::RotationRate> {
- public:
- static PassRefPtr<RotationRate> create(bool canProvideAlpha, double alpha,
- bool canProvideBeta, double beta,
- bool canProvideGamma, double gamma);
-
- bool canProvideAlpha() const { return m_canProvideAlpha; }
- bool canProvideBeta() const { return m_canProvideBeta; }
- bool canProvideGamma() const { return m_canProvideGamma; }
-
- double alpha() const { return m_alpha; }
- double beta() const { return m_beta; }
- double gamma() const { return m_gamma; }
-
- private:
- RotationRate(bool canProvideAlpha, double alpha,
- bool canProvideBeta, double beta,
- bool canProvideGamma, double gamma);
-
- double m_alpha;
- double m_beta;
- double m_gamma;
-
- bool m_canProvideAlpha;
- bool m_canProvideBeta;
- bool m_canProvideGamma;
- };
-
static PassRefPtr<DeviceMotionData> create();
- static PassRefPtr<DeviceMotionData> create(PassRefPtr<Acceleration> acceleration,
- PassRefPtr<Acceleration> accelerationIncludingGravity,
- PassRefPtr<RotationRate> rotationRate,
+ static PassRefPtr<DeviceMotionData> create(bool canProvideXAcceleration, double xAcceleration,
+ bool canProvideYAcceleration, double yAcceleration,
+ bool canProvideZAcceleration, double zAcceleration,
+ bool canProvideXRotationRate, double xRotationRate,
+ bool canProvideYRotationRate, double yRotationRate,
+ bool canProvideZRotationRate, double zRotationRate,
bool canProvideInterval, double interval);
- const Acceleration* acceleration() const { return m_acceleration.get(); }
- const Acceleration* accelerationIncludingGravity() const { return m_accelerationIncludingGravity.get(); }
- const RotationRate* rotationRate() const { return m_rotationRate.get(); }
+ double xAcceleration() const { return m_xAcceleration; }
+ double yAcceleration() const { return m_yAcceleration; }
+ double zAcceleration() const { return m_zAcceleration; }
+ double xRotationRate() const { return m_xRotationRate; }
+ double yRotationRate() const { return m_yRotationRate; }
+ double zRotationRate() const { return m_zRotationRate; }
double interval() const { return m_interval; }
+
+ bool canProvideXAcceleration() const { return m_canProvideXAcceleration; }
+ bool canProvideYAcceleration() const { return m_canProvideYAcceleration; }
+ bool canProvideZAcceleration() const { return m_canProvideZAcceleration; }
+ bool canProvideXRotationRate() const { return m_canProvideXRotationRate; }
+ bool canProvideYRotationRate() const { return m_canProvideYRotationRate; }
+ bool canProvideZRotationRate() const { return m_canProvideZRotationRate; }
bool canProvideInterval() const { return m_canProvideInterval; }
private:
DeviceMotionData();
- DeviceMotionData(PassRefPtr<Acceleration> acceleration,
- PassRefPtr<Acceleration> accelerationIncludingGravity,
- PassRefPtr<RotationRate> rotationRate,
+ DeviceMotionData(bool canProvideXAcceleration, double xAcceleration,
+ bool canProvideYAcceleration, double yAcceleration,
+ bool canProvideZAcceleration, double zAcceleration,
+ bool canProvideXRotationRate, double xRotationRate,
+ bool canProvideYRotationRate, double yRotationRate,
+ bool canProvideZRotationRate, double zRotationRate,
bool canProvideInterval, double interval);
- RefPtr<Acceleration> m_acceleration;
- RefPtr<Acceleration> m_accelerationIncludingGravity;
- RefPtr<RotationRate> m_rotationRate;
+ bool m_canProvideXAcceleration;
+ bool m_canProvideYAcceleration;
+ bool m_canProvideZAcceleration;
+ bool m_canProvideXRotationRate;
+ bool m_canProvideYRotationRate;
+ bool m_canProvideZRotationRate;
bool m_canProvideInterval;
+
+ double m_xAcceleration;
+ double m_yAcceleration;
+ double m_zAcceleration;
+ double m_xRotationRate;
+ double m_yRotationRate;
+ double m_zRotationRate;
double m_interval;
};
diff --git a/WebCore/dom/DeviceMotionEvent.idl b/WebCore/dom/DeviceMotionEvent.idl
index 437ba4c..97e8e71 100644
--- a/WebCore/dom/DeviceMotionEvent.idl
+++ b/WebCore/dom/DeviceMotionEvent.idl
@@ -28,11 +28,14 @@ module core {
interface [
Conditional=DEVICE_ORIENTATION
] DeviceMotionEvent : Event {
- readonly attribute [Custom] Acceleration acceleration;
- readonly attribute [Custom] Acceleration accelerationIncludingGravity;
- readonly attribute [Custom] RotationRate rotationRate;
+ readonly attribute [Custom] double xAcceleration;
+ readonly attribute [Custom] double yAcceleration;
+ readonly attribute [Custom] double zAcceleration;
+ readonly attribute [Custom] double xRotationRate;
+ readonly attribute [Custom] double yRotationRate;
+ readonly attribute [Custom] double zRotationRate;
readonly attribute [Custom] double interval;
- [Custom] void initDeviceMotionEvent(in DOMString type, in boolean bubbles, in boolean cancelable, in Acceleration acceleration, in Acceleration accelerationIncludingGravity, in RotationRate rotationRate, in double interval);
+ [Custom] void initDeviceMotionEvent(in DOMString type, in boolean bubbles, in boolean cancelable, in double xAcceleration, in double yAcceleration, in double zAcceleration, in double xRotationRate, in double yRotationRate, in double zRotationRate, in double interval);
};
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list