[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

dino at apple.com dino at apple.com
Wed Dec 22 11:46:42 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 7c23a235d4949a8a66c851e475ef664cc543e360
Author: dino at apple.com <dino at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Aug 6 13:38:04 2010 +0000

    2010-08-06  Dean Jackson  <dino at apple.com>
    
            Reviewed by Simon Fraser and Steve Block.
    
            https://bugs.webkit.org/show_bug.cgi?id=42865
            Implement DeviceMotionEvent
    
            Implement the DeviceMotionEvent interface as defined
            in http://dev.w3.org/geo/api/spec-source-orientation.html
            This is currently an empty implementation, in that there is
            no motion client connected - the platform implementations
            will need to do that.
    
            Tests: fast/dom/DeviceMotion/create-event.html
                   fast/dom/DeviceMotion/optional-event-properties.html
                   fast/dom/DeviceMotion/window-property.html
    
            * Android.derived.jscbindings.mk:
            * Android.derived.v8bindings.mk:
            * Android.jscbindings.mk:
            * Android.mk:
            * Android.v8bindings.mk:
            * CMakeLists.txt:
            * Configurations/FeatureDefines.xcconfig:
            * DerivedSources.make:
            * GNUmakefile.am:
            * WebCore.gypi:
            * WebCore.pro:
            * WebCore.vcproj/WebCore.vcproj:
            * WebCore.xcodeproj/project.pbxproj:
              - Add new files for DeviceMotionEvent build support
            * bindings/generic/RuntimeEnabledFeatures.cpp:
            * bindings/generic/RuntimeEnabledFeatures.h:
              - new runtime flags for device motion
            * bindings/js/JSDeviceMotionEventCustom.cpp: Added.
            * bindings/v8/custom/V8DeviceMotionEventCustom.cpp: Added.
              - Custom JS binding to translate property access through
                to the DeviceMotionData object that the Event holds
            * bindings/js/JSEventCustom.cpp:
              - Include the custom code for DeviceMotionEvent
            * dom/DeviceMotionClient.h: Added.
              - Pure virtual client for DeviceMotion access
            * dom/DeviceMotionController.cpp: Added.
            * dom/DeviceMotionController.h: Added.
              - Controller class that manages event dispatch
            * dom/DeviceMotionData.cpp: Added.
            * dom/DeviceMotionData.h: Added.
              - Representation of the data that comes from a device motion
                client that is then used within the event.
            * dom/DeviceMotionEvent.cpp: Added.
            * dom/DeviceMotionEvent.h: Added.
            * dom/DeviceMotionEvent.idl: Added.
              - The actual event implementation
            * dom/Document.cpp:
            (WebCore::Document::createEvent):
              - Update createEvent to allow "devicemotion" events
            * dom/Event.cpp:
            * dom/Event.h:
              - isDeviceMotionEvent virtual method
            * dom/EventNames.h:
              - new "devicemotion" event type
            * page/DOMWindow.cpp:
            (WebCore::DOMWindow::addEventListener):
            * page/DOMWindow.h:
            * page/DOMWindow.idl:
              - allow creation of "devicemotion" events and pass registration
                through to the Page's deviceMotionController object
            * page/Page.cpp:
            * page/Page.h:
              - new PageClient for deviceMotionController
    
              Layout Tests:
    
              * fast/dom/Window/window-properties-device-orientation-expected.txt:
              * fast/dom/Window/window-properties-device-orientation.html:
              * fast/dom/Window/window-properties.html:
    
              Add some tests for the DeviceMotionEvent interface.
    
              * fast/dom/DeviceMotion/create-event-expected.txt: Added.
              * fast/dom/DeviceMotion/create-event.html: Added.
              * fast/dom/DeviceMotion/optional-event-properties-expected.txt: Added.
              * fast/dom/DeviceMotion/optional-event-properties.html: Added.
              * fast/dom/DeviceMotion/script-tests/TEMPLATE.html: Added.
              * fast/dom/DeviceMotion/script-tests/create-event.js: Added.
              * fast/dom/DeviceMotion/script-tests/optional-event-properties.js: Added.
              * fast/dom/DeviceMotion/script-tests/window-property.js: Added.
              * fast/dom/DeviceMotion/window-property-expected.txt: Added.
              * fast/dom/DeviceMotion/window-property.html: Added.
    
              Make sure these are skipped on Mac, Win, GTK and QT.
    
              * platform/gtk/Skipped:
              * platform/mac/Skipped:
              * platform/qt/Skipped:
              * platform/win/Skipped:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64845 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 8e74885..38a1082 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,38 @@
+2010-08-06  Dean Jackson  <dino at apple.com>
+
+        Reviewed by Simon Fraser and Steve Block
+
+        https://bugs.webkit.org/show_bug.cgi?id=42865
+        Implement DeviceMotionEvent
+
+        Add DeviceMotion and ondevicemotion testing to
+        the device-orientation test, and make sure the DeviceMotion
+        interface is not tested in the generic window object.
+
+        * fast/dom/Window/window-properties-device-orientation-expected.txt:
+        * fast/dom/Window/window-properties-device-orientation.html:
+        * fast/dom/Window/window-properties.html:
+
+        Add some tests for the DeviceMotionEvent interface.
+
+        * fast/dom/DeviceMotion/create-event-expected.txt: Added.
+        * fast/dom/DeviceMotion/create-event.html: Added.
+        * fast/dom/DeviceMotion/optional-event-properties-expected.txt: Added.
+        * fast/dom/DeviceMotion/optional-event-properties.html: Added.
+        * fast/dom/DeviceMotion/script-tests/TEMPLATE.html: Added.
+        * fast/dom/DeviceMotion/script-tests/create-event.js: Added.
+        * fast/dom/DeviceMotion/script-tests/optional-event-properties.js: Added.
+        * fast/dom/DeviceMotion/script-tests/window-property.js: Added.
+        * fast/dom/DeviceMotion/window-property-expected.txt: Added.
+        * fast/dom/DeviceMotion/window-property.html: Added.
+
+        Make sure these are skipped on Mac, Win, GTK and QT.
+
+        * platform/gtk/Skipped:
+        * platform/mac/Skipped:
+        * platform/qt/Skipped:
+        * platform/win/Skipped:
+
 2010-08-06  Pavel Feldman  <pfeldman at chromium.org>
 
         Not reviewed. Rolling out 64835, 64836 and 64839.
diff --git a/LayoutTests/fast/dom/DeviceMotion/create-event-expected.txt b/LayoutTests/fast/dom/DeviceMotion/create-event-expected.txt
new file mode 100644
index 0000000..fdc40c4
--- /dev/null
+++ b/LayoutTests/fast/dom/DeviceMotion/create-event-expected.txt
@@ -0,0 +1,30 @@
+Tests that document.createEvent() works with DeviceMotinEvent.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+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 '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.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/DeviceOrientation/create-event.html b/LayoutTests/fast/dom/DeviceMotion/create-event.html
similarity index 100%
copy from LayoutTests/fast/dom/DeviceOrientation/create-event.html
copy to LayoutTests/fast/dom/DeviceMotion/create-event.html
diff --git a/LayoutTests/fast/dom/DeviceMotion/optional-event-properties-expected.txt b/LayoutTests/fast/dom/DeviceMotion/optional-event-properties-expected.txt
new file mode 100644
index 0000000..0eabe35
--- /dev/null
+++ b/LayoutTests/fast/dom/DeviceMotion/optional-event-properties-expected.txt
@@ -0,0 +1,65 @@
+Tests the optional properties of DeviceMotionEvent. Each property should be null if not set, or set to null or undefined.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+event = document.createEvent('DeviceMotionEvent')
+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, 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.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.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.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.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.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/DeviceOrientation/optional-event-properties.html b/LayoutTests/fast/dom/DeviceMotion/optional-event-properties.html
similarity index 100%
copy from LayoutTests/fast/dom/DeviceOrientation/optional-event-properties.html
copy to LayoutTests/fast/dom/DeviceMotion/optional-event-properties.html
diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/TEMPLATE.html b/LayoutTests/fast/dom/DeviceMotion/script-tests/TEMPLATE.html
similarity index 100%
copy from LayoutTests/fast/dom/DeviceOrientation/script-tests/TEMPLATE.html
copy to LayoutTests/fast/dom/DeviceMotion/script-tests/TEMPLATE.html
diff --git a/LayoutTests/fast/dom/DeviceMotion/script-tests/create-event.js b/LayoutTests/fast/dom/DeviceMotion/script-tests/create-event.js
new file mode 100644
index 0000000..167329d
--- /dev/null
+++ b/LayoutTests/fast/dom/DeviceMotion/script-tests/create-event.js
@@ -0,0 +1,29 @@
+description("Tests that document.createEvent() works with DeviceMotinEvent.");
+
+var event = document.createEvent('DeviceMotionEvent');
+
+shouldBeTrue("typeof event == 'object'");
+
+shouldBeTrue("'type' in event");
+shouldBeTrue("'bubbles' in event");
+shouldBeTrue("'cancelable' 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.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
new file mode 100644
index 0000000..ab9b53b
--- /dev/null
+++ b/LayoutTests/fast/dom/DeviceMotion/script-tests/optional-event-properties.js
@@ -0,0 +1,68 @@
+description("Tests the optional properties of DeviceMotionEvent. Each property should be null if not set, or set to null or undefined.");
+
+var event;
+
+evalAndLog("event = document.createEvent('DeviceMotionEvent')");
+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, 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.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.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.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.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.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/DeviceMotion/script-tests/window-property.js b/LayoutTests/fast/dom/DeviceMotion/script-tests/window-property.js
new file mode 100644
index 0000000..c91848a
--- /dev/null
+++ b/LayoutTests/fast/dom/DeviceMotion/script-tests/window-property.js
@@ -0,0 +1,31 @@
+description("Tests that the window.DeviceMotionEvent and window.ondevicemotion properties are present.");
+
+function hasDeviceMotionEventProperty()
+{
+    for (var property in window) {
+        if (property == "DeviceMotionEvent")
+            return true;
+    }
+    return false;
+}
+
+shouldBeTrue("typeof window.DeviceMotionEvent == 'object'");
+shouldBeTrue("hasDeviceMotionEventProperty()");
+shouldBeTrue("'DeviceMotionEvent' in window");
+shouldBeTrue("window.hasOwnProperty('DeviceMotionEvent')");
+
+function hasOnDeviceMotionProperty()
+{
+    for (var property in window) {
+        if (property == "ondevicemotion")
+            return true;
+    }
+    return false;
+}
+
+shouldBeTrue("typeof window.ondevicemotion == 'object'");
+shouldBeTrue("hasOnDeviceMotionProperty()");
+shouldBeTrue("'ondevicemotion' in window");
+shouldBeTrue("window.hasOwnProperty('ondevicemotion')");
+
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/DeviceMotion/window-property-expected.txt b/LayoutTests/fast/dom/DeviceMotion/window-property-expected.txt
new file mode 100644
index 0000000..1552651
--- /dev/null
+++ b/LayoutTests/fast/dom/DeviceMotion/window-property-expected.txt
@@ -0,0 +1,17 @@
+Tests that the window.DeviceMotionEvent and window.ondevicemotion properties are present.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS typeof window.DeviceMotionEvent == 'object' is true
+PASS hasDeviceMotionEventProperty() is true
+PASS 'DeviceMotionEvent' in window is true
+PASS window.hasOwnProperty('DeviceMotionEvent') is true
+PASS typeof window.ondevicemotion == 'object' is true
+PASS hasOnDeviceMotionProperty() is true
+PASS 'ondevicemotion' in window is true
+PASS window.hasOwnProperty('ondevicemotion') is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/DeviceOrientation/window-property.html b/LayoutTests/fast/dom/DeviceMotion/window-property.html
similarity index 100%
copy from LayoutTests/fast/dom/DeviceOrientation/window-property.html
copy to LayoutTests/fast/dom/DeviceMotion/window-property.html
diff --git a/LayoutTests/fast/dom/Window/window-properties-device-orientation-expected.txt b/LayoutTests/fast/dom/Window/window-properties-device-orientation-expected.txt
index 62801eb..1fff0da 100644
--- a/LayoutTests/fast/dom/Window/window-properties-device-orientation-expected.txt
+++ b/LayoutTests/fast/dom/Window/window-properties-device-orientation-expected.txt
@@ -1,5 +1,7 @@
 This test dumps all of the properties that are reachable from the window.DeviceOrientationEvent and window.ondeviceorientation objects, along with their types.
 
+window.DeviceMotionEvent [function]
+window.ondevicemotion [null]
 window.DeviceOrientationEvent [function]
 window.ondeviceorientation [null]
 
diff --git a/LayoutTests/fast/dom/Window/window-properties-device-orientation.html b/LayoutTests/fast/dom/Window/window-properties-device-orientation.html
index 97e00bb..7e83fb2 100644
--- a/LayoutTests/fast/dom/Window/window-properties-device-orientation.html
+++ b/LayoutTests/fast/dom/Window/window-properties-device-orientation.html
@@ -1,4 +1,5 @@
-<p>This test dumps all of the properties that are reachable from the window.DeviceOrientationEvent and window.ondeviceorientation objects, along with their types.</p>
+<p>This test dumps all of the properties that are reachable from the window.DeviceMotionEvent window.ondevicemotion, window.DeviceOrientationEvent and window.ondeviceorientation objects, along with their types.
+  These properties are currently guarded by ENABLE_DEVICE_ORIENTATION.</p>
 <hr>
 <pre id="pre"></pre>
 
@@ -88,6 +89,8 @@ function logProperties(object, objectName)
     }
 }
 
+logValue('window.DeviceMotionEvent');
+logValue('window.ondevicemotion');
 logValue('window.DeviceOrientationEvent');
 logValue('window.ondeviceorientation');
 flushLog();
diff --git a/LayoutTests/fast/dom/Window/window-properties.html b/LayoutTests/fast/dom/Window/window-properties.html
index b0437f3..b60a368 100644
--- a/LayoutTests/fast/dom/Window/window-properties.html
+++ b/LayoutTests/fast/dom/Window/window-properties.html
@@ -86,6 +86,8 @@ var __skip__ = {
     "window.BlobBuilder" : 1,
     "window.DeviceOrientationEvent" : 1,
     "window.ondeviceorientation" : 1,
+    "window.DeviceMotionEvent" : 1,
+    "window.ondevicemotion" : 1,
     "window.webkitPerformance" : 1,
 
     // showModalDialog is not implemented on all platforms in DumpRenderTree.
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index 098c00d..dfaf827 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -1081,6 +1081,9 @@ fast/dom/client-width-height-quirks.html
 fast/dom/client-width-height.html
 fast/dom/cssTarget-crash.html
 fast/dom/frame-loading-via-document-write.html
+fast/dom/DeviceMotion/create-event.html
+fast/dom/DeviceMotion/optional-event-properties.html
+fast/dom/DeviceMotion/window-property.html
 fast/dom/DeviceOrientation/basic-operation.html
 fast/dom/DeviceOrientation/create-event.html
 fast/dom/DeviceOrientation/optional-event-properties.html
diff --git a/LayoutTests/platform/mac/Skipped b/LayoutTests/platform/mac/Skipped
index 197d497..1e3b65c 100644
--- a/LayoutTests/platform/mac/Skipped
+++ b/LayoutTests/platform/mac/Skipped
@@ -240,7 +240,8 @@ canvas/philip/tests/type.prototype.html
 # IndexedDB is not yet enabled.
 storage/indexeddb
 
-# This port doesn't support DeviceOrientation.
+# This port doesn't support DeviceMotion or DeviceOrientation.
+fast/dom/DeviceMotion
 fast/dom/DeviceOrientation
 fast/dom/Window/window-properties-device-orientation.html
 
diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped
index f84a9fa..5926dd6 100644
--- a/LayoutTests/platform/qt/Skipped
+++ b/LayoutTests/platform/qt/Skipped
@@ -78,7 +78,8 @@ plugins/clicking-missing-plugin-fires-delegate.html
 #       Feature not supported... yet
 # =========================================================================== #
 
-# This port doesn't support DeviceOrientation.
+# This port doesn't support DeviceMotion or DeviceOrientation.
+fast/dom/DeviceMotion
 fast/dom/DeviceOrientation
 fast/dom/Window/window-properties-device-orientation.html
 
diff --git a/LayoutTests/platform/win/Skipped b/LayoutTests/platform/win/Skipped
index ddc7cfe..5b12ba9 100644
--- a/LayoutTests/platform/win/Skipped
+++ b/LayoutTests/platform/win/Skipped
@@ -874,7 +874,8 @@ editing/spelling/context-menu-suggestions.html
 # IndexedDB is not yet enabled.
 storage/indexeddb
 
-# This port doesn't support DeviceOrientation.
+# This port doesn't support DeviceMotion or DeviceOrientation.
+fast/dom/DeviceMotion
 fast/dom/DeviceOrientation
 fast/dom/Window/window-properties-device-orientation.html
 
diff --git a/WebCore/Android.derived.jscbindings.mk b/WebCore/Android.derived.jscbindings.mk
index cc3ae07..29efa6f 100644
--- a/WebCore/Android.derived.jscbindings.mk
+++ b/WebCore/Android.derived.jscbindings.mk
@@ -105,6 +105,7 @@ GEN := \
     $(intermediates)/dom/JSDOMCoreException.h \
     $(intermediates)/dom/JSDOMImplementation.h \
     $(intermediates)/dom/JSDOMStringList.h \
+    $(intermediates)/dom/JSDeviceMotionEvent.h \
     $(intermediates)/dom/JSDeviceOrientationEvent.h \
     $(intermediates)/dom/JSDocument.h \
     $(intermediates)/dom/JSDocumentFragment.h \
diff --git a/WebCore/Android.derived.v8bindings.mk b/WebCore/Android.derived.v8bindings.mk
index ee24058..93037b3 100644
--- a/WebCore/Android.derived.v8bindings.mk
+++ b/WebCore/Android.derived.v8bindings.mk
@@ -86,6 +86,7 @@ GEN := \
     $(intermediates)/bindings/V8DOMCoreException.h \
     $(intermediates)/bindings/V8DOMImplementation.h \
     $(intermediates)/bindings/V8DOMStringList.h \
+    $(intermediates)/bindings/V8DeviceMotionEvent.h \
     $(intermediates)/bindings/V8DeviceOrientationEvent.h \
     $(intermediates)/bindings/V8Document.h \
     $(intermediates)/bindings/V8DocumentFragment.h \
diff --git a/WebCore/Android.jscbindings.mk b/WebCore/Android.jscbindings.mk
index 01b5a16..7013066 100644
--- a/WebCore/Android.jscbindings.mk
+++ b/WebCore/Android.jscbindings.mk
@@ -93,6 +93,7 @@ LOCAL_SRC_FILES += \
 	bindings/js/JSDatabaseCustom.cpp \
 	bindings/js/JSDedicatedWorkerContextCustom.cpp \
 	bindings/js/JSDesktopNotificationsCustom.cpp \
+	bindings/js/JSDeviceMotionEventCustom.cpp \
 	bindings/js/JSDeviceOrientationEventCustom.cpp \
 	bindings/js/JSDocumentCustom.cpp \
 	bindings/js/JSElementCustom.cpp \
diff --git a/WebCore/Android.mk b/WebCore/Android.mk
index b4c5188..83f82ed 100644
--- a/WebCore/Android.mk
+++ b/WebCore/Android.mk
@@ -117,6 +117,9 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
 	dom/DOMImplementation.cpp \
 	dom/DOMStringList.cpp \
 	dom/DecodedDataDocumentParser.cpp \
+	dom/DeviceMotionController.cpp \
+	dom/DeviceMotionData.cpp \
+	dom/DeviceMotionEvent.cpp \
 	dom/Document.cpp \
 	dom/DocumentFragment.cpp \
 	dom/DocumentParser.cpp \
diff --git a/WebCore/Android.v8bindings.mk b/WebCore/Android.v8bindings.mk
index b36beab..7074636 100644
--- a/WebCore/Android.v8bindings.mk
+++ b/WebCore/Android.v8bindings.mk
@@ -108,6 +108,7 @@ LOCAL_SRC_FILES += \
 	bindings/v8/custom/V8DatabaseCallback.cpp \
 	bindings/v8/custom/V8DatabaseCustom.cpp \
 	bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp \
+	bindings/v8/custom/V8DeviceMotionEventCustom.cpp \
 	bindings/v8/custom/V8DeviceOrientationEventCustom.cpp \
 	bindings/v8/custom/V8DocumentCustom.cpp \
 	bindings/v8/custom/V8DocumentLocationCustom.cpp \
diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt
index bf1a052..6b18a2b 100644
--- a/WebCore/CMakeLists.txt
+++ b/WebCore/CMakeLists.txt
@@ -144,6 +144,7 @@ SET(WebCore_IDL_FILES
     dom/Comment.idl
     dom/CompositionEvent.idl
     dom/CustomEvent.idl
+    dom/DeviceMotionEvent.idl
     dom/DeviceOrientationEvent.idl
     dom/DocumentFragment.idl
     dom/Document.idl
@@ -596,6 +597,7 @@ SET(WebCore_SOURCES
     bindings/js/JSDataGridDataSource.cpp
     bindings/js/JSDebugWrapperSet.cpp
     bindings/js/JSDedicatedWorkerContextCustom.cpp
+    bindings/js/JSDeviceMotionEventCustom.cpp
     bindings/js/JSDeviceOrientationEventCustom.cpp
     bindings/js/JSDocumentCustom.cpp
     bindings/js/JSDOMApplicationCacheCustom.cpp
@@ -791,6 +793,9 @@ SET(WebCore_SOURCES
     dom/CustomEvent.cpp
     dom/DatasetDOMStringMap.cpp
     dom/DecodedDataDocumentParser.cpp
+    dom/DeviceMotionController.cpp
+    dom/DeviceMotionData.cpp
+    dom/DeviceMotionEvent.cpp
     dom/DeviceOrientation.cpp
     dom/DeviceOrientationController.cpp
     dom/DeviceOrientationEvent.cpp
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 113e4b8..69d9f32 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,74 @@
+2010-08-06  Dean Jackson  <dino at apple.com>
+
+        Reviewed by Simon Fraser and Steve Block.
+
+        https://bugs.webkit.org/show_bug.cgi?id=42865
+        Implement DeviceMotionEvent
+
+        Implement the DeviceMotionEvent interface as defined
+        in http://dev.w3.org/geo/api/spec-source-orientation.html
+        This is currently an empty implementation, in that there is
+        no motion client connected - the platform implementations
+        will need to do that.
+
+        Tests: fast/dom/DeviceMotion/create-event.html
+               fast/dom/DeviceMotion/optional-event-properties.html
+               fast/dom/DeviceMotion/window-property.html
+
+        * Android.derived.jscbindings.mk:
+        * Android.derived.v8bindings.mk:
+        * Android.jscbindings.mk:
+        * Android.mk:
+        * Android.v8bindings.mk:
+        * CMakeLists.txt:
+        * Configurations/FeatureDefines.xcconfig:
+        * DerivedSources.make:
+        * GNUmakefile.am:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+          - Add new files for DeviceMotionEvent build support
+        * bindings/generic/RuntimeEnabledFeatures.cpp:
+        * bindings/generic/RuntimeEnabledFeatures.h:
+          - new runtime flags for device motion
+        * bindings/js/JSDeviceMotionEventCustom.cpp: Added.
+        * bindings/v8/custom/V8DeviceMotionEventCustom.cpp: Added.
+          - Custom JS binding to translate property access through
+            to the DeviceMotionData object that the Event holds
+        * bindings/js/JSEventCustom.cpp:
+          - Include the custom code for DeviceMotionEvent
+        * dom/DeviceMotionClient.h: Added.
+          - Pure virtual client for DeviceMotion access
+        * dom/DeviceMotionController.cpp: Added.
+        * dom/DeviceMotionController.h: Added.
+          - Controller class that manages event dispatch
+        * dom/DeviceMotionData.cpp: Added.
+        * dom/DeviceMotionData.h: Added.
+          - Representation of the data that comes from a device motion
+            client that is then used within the event.
+        * dom/DeviceMotionEvent.cpp: Added.
+        * dom/DeviceMotionEvent.h: Added.
+        * dom/DeviceMotionEvent.idl: Added.
+          - The actual event implementation
+        * dom/Document.cpp:
+        (WebCore::Document::createEvent):
+          - Update createEvent to allow "devicemotion" events
+        * dom/Event.cpp:
+        * dom/Event.h:
+          - isDeviceMotionEvent virtual method
+        * dom/EventNames.h:
+          - new "devicemotion" event type
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::addEventListener):
+        * page/DOMWindow.h:
+        * page/DOMWindow.idl:
+          - allow creation of "devicemotion" events and pass registration
+            through to the Page's deviceMotionController object
+        * page/Page.cpp:
+        * page/Page.h:
+          - new PageClient for deviceMotionController
+
 2010-08-06  Kavita Kanetkar  <kkanetkar at chromium.org>
 
         Reviewed by Joseph Pecoraro.
diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make
index b651119..f25e91e 100644
--- a/WebCore/DerivedSources.make
+++ b/WebCore/DerivedSources.make
@@ -127,6 +127,7 @@ DOM_CLASSES = \
     Database \
     DatabaseCallback \
     DatabaseSync \
+    DeviceMotionEvent \
     DeviceOrientationEvent \
     Document \
     DocumentFragment \
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index b2a3e53..b684ca2 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -181,6 +181,8 @@ webcore_built_sources += \
 	DerivedSources/WebCore/JSDataGridColumnList.h \
 	DerivedSources/WebCore/JSDedicatedWorkerContext.cpp \
 	DerivedSources/WebCore/JSDedicatedWorkerContext.h \
+	DerivedSources/WebCore/JSDeviceMotionEvent.cpp \
+	DerivedSources/WebCore/JSDeviceMotionEvent.h \
 	DerivedSources/WebCore/JSDeviceOrientationEvent.cpp \
 	DerivedSources/WebCore/JSDeviceOrientationEvent.h \
 	DerivedSources/WebCore/JSDocument.cpp \
@@ -671,6 +673,7 @@ webcore_sources += \
 	WebCore/bindings/js/JSDOMWindowShell.h \
 	WebCore/bindings/js/JSDOMWrapper.cpp \
 	WebCore/bindings/js/JSDOMWrapper.h \
+	WebCore/bindings/js/JSDeviceMotionEventCustom.cpp \
 	WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp \
 	WebCore/bindings/js/JSDocumentCustom.cpp \
 	WebCore/bindings/js/JSElementCustom.cpp \
@@ -1019,6 +1022,13 @@ webcore_sources += \
 	WebCore/dom/DatasetDOMStringMap.h \
 	WebCore/dom/DecodedDataDocumentParser.cpp \
 	WebCore/dom/DecodedDataDocumentParser.h \
+	WebCore/dom/DeviceMotionClient.h \
+	WebCore/dom/DeviceMotionController.cpp \
+	WebCore/dom/DeviceMotionController.h \
+	WebCore/dom/DeviceMotionData.cpp \
+	WebCore/dom/DeviceMotionData.h \
+	WebCore/dom/DeviceMotionEvent.cpp \
+	WebCore/dom/DeviceMotionEvent.h \
 	WebCore/dom/DeviceOrientation.cpp \
 	WebCore/dom/DeviceOrientation.h \
 	WebCore/dom/DeviceOrientationClient.h \
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index 7fc8956..a96b190 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -405,6 +405,7 @@ __ZN7WebCore16isEndOfParagraphERKNS_15VisiblePositionE
 __ZN7WebCore16jsStringSlowCaseEPN3JSC9ExecStateERNS0_9WeakGCMapIPNS_10StringImplEPNS0_8JSStringEEES5_
 __ZN7WebCore17CredentialStorage3getERKNS_15ProtectionSpaceE
 __ZN7WebCore17DOMImplementation14isTextMIMETypeERKNS_6StringE
+__ZN7WebCore16DeviceMotionData6createEbdbdbdbdbdbdbd
 __ZN7WebCore17DeviceOrientation6createEbdbdbd
 __ZN7WebCore17GlyphPageTreeNode18treeGlyphPageCountEv
 __ZN7WebCore17HTMLPlugInElement11getNPObjectEv
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 4e35085..fe0f369 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -43,6 +43,7 @@
             'dom/DOMImplementation.idl',
             'dom/DOMStringList.idl',
             'dom/DOMStringMap.idl',
+            'dom/DeviceMotionEvent.idl',
             'dom/DeviceOrientationEvent.idl',
             'dom/Document.idl',
             'dom/DocumentFragment.idl',
@@ -550,6 +551,7 @@
             'bindings/js/JSDedicatedWorkerContextCustom.cpp',
             'bindings/js/JSDebugWrapperSet.cpp',
             'bindings/js/JSDebugWrapperSet.h',
+            'bindings/js/JSDeviceMotionEventCustom.cpp',
             'bindings/js/JSDeviceOrientationEventCustom.cpp',
             'bindings/js/JSDocumentCustom.cpp',
             'bindings/js/JSDOMApplicationCacheCustom.cpp',
@@ -744,6 +746,7 @@
             'bindings/v8/custom/V8DatabaseSyncCustom.cpp',
             'bindings/v8/custom/V8DataGridColumnListCustom.cpp',
             'bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp',
+            'bindings/v8/custom/V8DeviceMotionEventCustom.cpp',
             'bindings/v8/custom/V8DeviceOrientationEventCustom.cpp',
             'bindings/v8/custom/V8DocumentLocationCustom.cpp',
             'bindings/v8/custom/V8DOMFormDataCustom.cpp',
@@ -1125,6 +1128,13 @@
             'dom/DatasetDOMStringMap.h',
             'dom/DecodedDataDocumentParser.cpp',
             'dom/DecodedDataDocumentParser.h',
+            'dom/DeviceMotionClient.h',
+            'dom/DeviceMotionController.cpp',
+            'dom/DeviceMotionController.h',
+            'dom/DeviceMotionData.cpp',
+            'dom/DeviceMotionData.h',
+            'dom/DeviceMotionEvent.cpp',
+            'dom/DeviceMotionEvent.h',
             'dom/DeviceOrientation.cpp',
             'dom/DeviceOrientation.h',
             'dom/DeviceOrientationClient.h',
diff --git a/WebCore/WebCore.pri b/WebCore/WebCore.pri
index 54e996e..7dd0681 100644
--- a/WebCore/WebCore.pri
+++ b/WebCore/WebCore.pri
@@ -293,6 +293,7 @@ IDL_BINDINGS += \
     dom/Comment.idl \
     dom/CompositionEvent.idl \
     dom/CustomEvent.idl \
+    dom/DeviceMotionEvent.idl \
     dom/DeviceOrientationEvent.idl \
     dom/DocumentFragment.idl \
     dom/Document.idl \
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 2a841a5..4072b41 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -301,6 +301,7 @@ SOURCES += \
     bindings/js/JSDataGridDataSource.cpp \
     bindings/js/JSDebugWrapperSet.cpp \
     bindings/js/JSDesktopNotificationsCustom.cpp \
+    bindings/js/JSDeviceMotionEventCustom.cpp \
     bindings/js/JSDeviceOrientationEventCustom.cpp \
     bindings/js/JSDocumentCustom.cpp \
     bindings/js/JSDOMFormDataCustom.cpp \
@@ -478,6 +479,9 @@ SOURCES += \
     dom/CSSMappedAttributeDeclaration.cpp \
     dom/CustomEvent.cpp \
     dom/DecodedDataDocumentParser.cpp \
+    dom/DeviceMotionController.cpp \
+    dom/DeviceMotionData.cpp \
+    dom/DeviceMotionEvent.cpp \
     dom/DeviceOrientation.cpp \
     dom/DeviceOrientationController.cpp \
     dom/DeviceOrientationEvent.cpp \
@@ -1241,6 +1245,10 @@ HEADERS += \
     dom/CSSMappedAttributeDeclaration.h \
     dom/CustomEvent.h \
     dom/default/PlatformMessagePortChannel.h \
+    dom/DeviceMotionClient.h \
+    dom/DeviceMotionData.h \
+    dom/DeviceMotionController.h \
+    dom/DeviceMotionEvent.h \
     dom/DeviceOrientation.h \
     dom/DeviceOrientationClient.h \
     dom/DeviceOrientationController.h \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 78d5264..50dceec 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -2905,6 +2905,62 @@
 				>
 			</File>
 			<File
+				RelativePath="$(WebKitOutputDir)\obj\WebCore\DerivedSources\JSDeviceMotionEvent.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug_Internal|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug_Cairo|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release_Cairo|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug_All|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="$(WebKitOutputDir)\obj\WebCore\DerivedSources\JSDeviceMotionEvent.h"
+				>
+			</File>
+			<File
 				RelativePath="$(WebKitOutputDir)\obj\WebCore\DerivedSources\JSDeviceOrientationEvent.cpp"
 				>
 				<FileConfiguration
@@ -32653,6 +32709,34 @@
 				>
 			</File>
 			<File
+				RelativePath="..\dom\DeviceMotionClient.h"
+				>
+			</File>
+			<File
+				RelativePath="..\dom\DeviceMotionController.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\dom\DeviceMotionController.h"
+				>
+			</File>
+			<File
+				RelativePath="..\dom\DeviceMotionData.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\dom\DeviceMotionData.h"
+				>
+			</File>
+			<File
+				RelativePath="..\dom\DeviceMotionEvent.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\dom\DeviceMotionEvent.h"
+				>
+			</File>
+			<File
 				RelativePath="..\dom\DeviceOrientation.cpp"
 				>
 			</File>
@@ -42448,6 +42532,58 @@
 					</FileConfiguration>
 				</File>
 				<File
+					RelativePath="..\bindings\js\JSDeviceMotionEventCustom.cpp"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug_Internal|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug_Cairo|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Release_Cairo|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+					<FileConfiguration
+						Name="Debug_All|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
 					RelativePath="..\bindings\js\JSDeviceOrientationEventCustom.cpp"
 					>
 					<FileConfiguration
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 687b5c5..37f9933 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -750,6 +750,16 @@
 		31C0FF4C0E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 31C0FF460E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.h */; };
 		31C0FF4D0E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = 31C0FF470E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.mm */; };
 		31C0FF4E0E4CEFDD007D6FE5 /* DOMWebKitTransitionEventInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 31C0FF480E4CEFDD007D6FE5 /* DOMWebKitTransitionEventInternal.h */; };
+		31FB1A57120A5D0600DC02A0 /* DeviceMotionClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 31FB1A4F120A5D0600DC02A0 /* DeviceMotionClient.h */; };
+		31FB1A58120A5D0600DC02A0 /* DeviceMotionController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31FB1A50120A5D0600DC02A0 /* DeviceMotionController.cpp */; };
+		31FB1A59120A5D0600DC02A0 /* DeviceMotionController.h in Headers */ = {isa = PBXBuildFile; fileRef = 31FB1A51120A5D0600DC02A0 /* DeviceMotionController.h */; };
+		31FB1A5A120A5D0600DC02A0 /* DeviceMotionData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31FB1A52120A5D0600DC02A0 /* DeviceMotionData.cpp */; };
+		31FB1A5B120A5D0600DC02A0 /* DeviceMotionData.h in Headers */ = {isa = PBXBuildFile; fileRef = 31FB1A53120A5D0600DC02A0 /* DeviceMotionData.h */; };
+		31FB1A5C120A5D0600DC02A0 /* DeviceMotionEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31FB1A54120A5D0600DC02A0 /* DeviceMotionEvent.cpp */; };
+		31FB1A5D120A5D0600DC02A0 /* DeviceMotionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 31FB1A55120A5D0600DC02A0 /* DeviceMotionEvent.h */; };
+		31FB1A65120A5D3F00DC02A0 /* JSDeviceMotionEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31FB1A63120A5D3F00DC02A0 /* JSDeviceMotionEvent.cpp */; };
+		31FB1A66120A5D3F00DC02A0 /* JSDeviceMotionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 31FB1A64120A5D3F00DC02A0 /* JSDeviceMotionEvent.h */; };
+		31FB1A6C120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31FB1A6B120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp */; };
 		3314ACEB10892086000F0E56 /* JSExceptionBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3314ACE910892086000F0E56 /* JSExceptionBase.cpp */; };
 		3314ACEC10892086000F0E56 /* JSExceptionBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 3314ACEA10892086000F0E56 /* JSExceptionBase.h */; };
 		33503C9A10179A74003B47E1 /* NotificationPresenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 33503C9910179A74003B47E1 /* NotificationPresenter.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -6479,6 +6489,17 @@
 		31C0FF460E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWebKitTransitionEvent.h; sourceTree = "<group>"; };
 		31C0FF470E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMWebKitTransitionEvent.mm; sourceTree = "<group>"; };
 		31C0FF480E4CEFDD007D6FE5 /* DOMWebKitTransitionEventInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWebKitTransitionEventInternal.h; sourceTree = "<group>"; };
+		31FB1A4F120A5D0600DC02A0 /* DeviceMotionClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceMotionClient.h; sourceTree = "<group>"; };
+		31FB1A50120A5D0600DC02A0 /* DeviceMotionController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceMotionController.cpp; sourceTree = "<group>"; };
+		31FB1A51120A5D0600DC02A0 /* DeviceMotionController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceMotionController.h; sourceTree = "<group>"; };
+		31FB1A52120A5D0600DC02A0 /* DeviceMotionData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceMotionData.cpp; sourceTree = "<group>"; };
+		31FB1A53120A5D0600DC02A0 /* DeviceMotionData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceMotionData.h; sourceTree = "<group>"; };
+		31FB1A54120A5D0600DC02A0 /* DeviceMotionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceMotionEvent.cpp; sourceTree = "<group>"; };
+		31FB1A55120A5D0600DC02A0 /* DeviceMotionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceMotionEvent.h; sourceTree = "<group>"; };
+		31FB1A56120A5D0600DC02A0 /* DeviceMotionEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DeviceMotionEvent.idl; sourceTree = "<group>"; };
+		31FB1A63120A5D3F00DC02A0 /* JSDeviceMotionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeviceMotionEvent.cpp; sourceTree = "<group>"; };
+		31FB1A64120A5D3F00DC02A0 /* JSDeviceMotionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDeviceMotionEvent.h; sourceTree = "<group>"; };
+		31FB1A6B120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeviceMotionEventCustom.cpp; sourceTree = "<group>"; };
 		3314ACE910892086000F0E56 /* JSExceptionBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSExceptionBase.cpp; sourceTree = "<group>"; };
 		3314ACEA10892086000F0E56 /* JSExceptionBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSExceptionBase.h; sourceTree = "<group>"; };
 		333F704E0FB49CA2008E12A6 /* Notification.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Notification.idl; path = notifications/Notification.idl; sourceTree = "<group>"; };
@@ -14769,6 +14790,8 @@
 				93F9B6DF0BA0FB7200854064 /* JSComment.h */,
 				FE6FD48B0F676E9300092873 /* JSCoordinates.cpp */,
 				FE6FD48C0F676E9300092873 /* JSCoordinates.h */,
+				31FB1A63120A5D3F00DC02A0 /* JSDeviceMotionEvent.cpp */,
+				31FB1A64120A5D3F00DC02A0 /* JSDeviceMotionEvent.h */,
 				59A86005119DAF7F00DEF1EF /* JSDeviceOrientationEvent.cpp */,
 				59A86007119DAFA100DEF1EF /* JSDeviceOrientationEvent.h */,
 				659DDC8009E198BA001BF3C6 /* JSDocument.cpp */,
@@ -15954,6 +15977,7 @@
 				BC77D1510FF19C730070887B /* JSDataGridColumnListCustom.cpp */,
 				4162A453101145E300DFF3ED /* JSDedicatedWorkerContextCustom.cpp */,
 				33503CBF10179C1A003B47E1 /* JSDesktopNotificationsCustom.cpp */,
+				31FB1A6B120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp */,
 				590E1B4A11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp */,
 				49C7BA8C1042F5B10009D447 /* JSDocumentCustom.cpp */,
 				1AC226160DB69F740089B669 /* JSDOMApplicationCacheCustom.cpp */,
@@ -17104,6 +17128,14 @@
 				BC64641A11D7F416006455B0 /* DatasetDOMStringMap.h */,
 				A8C228A011D5722E00D5A7D3 /* DecodedDataDocumentParser.cpp */,
 				A8C2289F11D5722E00D5A7D3 /* DecodedDataDocumentParser.h */,
+				31FB1A4F120A5D0600DC02A0 /* DeviceMotionClient.h */,
+				31FB1A50120A5D0600DC02A0 /* DeviceMotionController.cpp */,
+				31FB1A51120A5D0600DC02A0 /* DeviceMotionController.h */,
+				31FB1A52120A5D0600DC02A0 /* DeviceMotionData.cpp */,
+				31FB1A53120A5D0600DC02A0 /* DeviceMotionData.h */,
+				31FB1A54120A5D0600DC02A0 /* DeviceMotionEvent.cpp */,
+				31FB1A55120A5D0600DC02A0 /* DeviceMotionEvent.h */,
+				31FB1A56120A5D0600DC02A0 /* DeviceMotionEvent.idl */,
 				59D1C10311EB5DCF00B638C8 /* DeviceOrientation.cpp */,
 				590E1B4811E4EF4B0069F784 /* DeviceOrientation.h */,
 				59A8F1D711A69520001AC34A /* DeviceOrientationClient.h */,
@@ -20031,6 +20063,11 @@
 				E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */,
 				97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */,
 				CE172E011136E8CE0062A533 /* ZoomMode.h in Headers */,
+				31FB1A57120A5D0600DC02A0 /* DeviceMotionClient.h in Headers */,
+				31FB1A59120A5D0600DC02A0 /* DeviceMotionController.h in Headers */,
+				31FB1A5B120A5D0600DC02A0 /* DeviceMotionData.h in Headers */,
+				31FB1A5D120A5D0600DC02A0 /* DeviceMotionEvent.h in Headers */,
+				31FB1A66120A5D3F00DC02A0 /* JSDeviceMotionEvent.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -22440,6 +22477,11 @@
 				93F19B0508245E59001E9ABC /* XSLTProcessorLibxslt.cpp in Sources */,
 				E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
 				97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */,
+				31FB1A58120A5D0600DC02A0 /* DeviceMotionController.cpp in Sources */,
+				31FB1A5A120A5D0600DC02A0 /* DeviceMotionData.cpp in Sources */,
+				31FB1A5C120A5D0600DC02A0 /* DeviceMotionEvent.cpp in Sources */,
+				31FB1A65120A5D3F00DC02A0 /* JSDeviceMotionEvent.cpp in Sources */,
+				31FB1A6C120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp b/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp
index eb027c3..94e984f 100644
--- a/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp
+++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp
@@ -47,6 +47,7 @@ bool RuntimeEnabledFeatures::isIndexedDBEnabled = false;
 bool RuntimeEnabledFeatures::isWebGLEnabled = false;
 bool RuntimeEnabledFeatures::isPushStateEnabled = false;
 bool RuntimeEnabledFeatures::isTouchEnabled = true;
+bool RuntimeEnabledFeatures::isDeviceMotionEnabled = true;
 bool RuntimeEnabledFeatures::isDeviceOrientationEnabled = true;
 bool RuntimeEnabledFeatures::isSpeechInputEnabled = true;
 
diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.h b/WebCore/bindings/generic/RuntimeEnabledFeatures.h
index c9eb21f..fd7308e 100644
--- a/WebCore/bindings/generic/RuntimeEnabledFeatures.h
+++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.h
@@ -114,6 +114,11 @@ public:
     static bool ontouchcancelEnabled() { return isTouchEnabled; }
 #endif
 
+    static void setDeviceMotionEnabled(bool isEnabled) { isDeviceMotionEnabled = isEnabled; }
+    static bool deviceMotionEnabled() { return isDeviceMotionEnabled; }
+    static bool deviceMotionEventEnabled() { return isDeviceMotionEnabled; }
+    static bool ondevicemotionEnabled() { return isDeviceMotionEnabled; }
+    
     static void setDeviceOrientationEnabled(bool isEnabled) { isDeviceOrientationEnabled = isEnabled; }
     static bool deviceOrientationEnabled() { return isDeviceOrientationEnabled; }
     static bool deviceOrientationEventEnabled() { return isDeviceOrientationEnabled; }
@@ -136,6 +141,7 @@ private:
     static bool isWebGLEnabled;
     static bool isPushStateEnabled;
     static bool isTouchEnabled;
+    static bool isDeviceMotionEnabled;
     static bool isDeviceOrientationEnabled;
     static bool isSpeechInputEnabled;
 };
diff --git a/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp b/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp
new file mode 100644
index 0000000..225a626
--- /dev/null
+++ b/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp
@@ -0,0 +1,129 @@
+/*
+ * 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"
+#include "JSDeviceMotionEvent.h"
+
+#if ENABLE(DEVICE_ORIENTATION)
+
+#include "DeviceMotionData.h"
+#include "DeviceMotionEvent.h"
+
+using namespace JSC;
+
+namespace WebCore {
+
+JSValue JSDeviceMotionEvent::xAcceleration(ExecState* exec) const
+{
+    DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
+    if (!imp->deviceMotionData()->canProvideXAcceleration())
+        return jsNull();
+    return jsNumber(exec, imp->deviceMotionData()->xAcceleration());
+}
+
+JSValue JSDeviceMotionEvent::yAcceleration(ExecState* exec) const
+{
+    DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
+    if (!imp->deviceMotionData()->canProvideYAcceleration())
+        return jsNull();
+    return jsNumber(exec, imp->deviceMotionData()->yAcceleration());
+}
+
+JSValue JSDeviceMotionEvent::zAcceleration(ExecState* exec) const
+{
+    DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
+    if (!imp->deviceMotionData()->canProvideZAcceleration())
+        return jsNull();
+    return jsNumber(exec, imp->deviceMotionData()->zAcceleration());
+}
+
+JSValue JSDeviceMotionEvent::xRotationRate(ExecState* exec) const
+{
+    DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
+    if (!imp->deviceMotionData()->canProvideXRotationRate())
+        return jsNull();
+    return jsNumber(exec, imp->deviceMotionData()->xRotationRate());
+}
+
+JSValue JSDeviceMotionEvent::yRotationRate(ExecState* exec) const
+{
+    DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
+    if (!imp->deviceMotionData()->canProvideYRotationRate())
+        return jsNull();
+    return jsNumber(exec, imp->deviceMotionData()->yRotationRate());
+}
+
+JSValue JSDeviceMotionEvent::zRotationRate(ExecState* exec) const
+{
+    DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
+    if (!imp->deviceMotionData()->canProvideZRotationRate())
+        return jsNull();
+    return jsNumber(exec, imp->deviceMotionData()->zRotationRate());
+}
+    
+JSValue JSDeviceMotionEvent::interval(ExecState* exec) const
+{
+    DeviceMotionEvent* imp = static_cast<DeviceMotionEvent*>(impl());
+    if (!imp->deviceMotionData()->canProvideInterval())
+        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.
+    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());
+    return jsUndefined();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(DEVICE_ORIENTATION)
diff --git a/WebCore/bindings/js/JSEventCustom.cpp b/WebCore/bindings/js/JSEventCustom.cpp
index b6190ff..7479020 100644
--- a/WebCore/bindings/js/JSEventCustom.cpp
+++ b/WebCore/bindings/js/JSEventCustom.cpp
@@ -32,12 +32,14 @@
 #include "Clipboard.h"
 #include "CompositionEvent.h"
 #include "CustomEvent.h"
+#include "DeviceMotionEvent.h"
 #include "DeviceOrientationEvent.h"
 #include "Event.h"
 #include "JSBeforeLoadEvent.h"
 #include "JSClipboard.h"
 #include "JSCustomEvent.h"
 #include "JSCompositionEvent.h"
+#include "JSDeviceMotionEvent.h"
 #include "JSDeviceOrientationEvent.h"
 #include "JSErrorEvent.h"
 #include "JSKeyboardEvent.h"
@@ -173,6 +175,8 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Event* event)
     else if (event->isCustomEvent())
         wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, CustomEvent, event);
 #if ENABLE(DEVICE_ORIENTATION)
+    else if (event->isDeviceMotionEvent())
+        wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, DeviceMotionEvent, event);
     else if (event->isDeviceOrientationEvent())
         wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, DeviceOrientationEvent, event);
 #endif
diff --git a/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp b/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp
new file mode 100644
index 0000000..39692b6
--- /dev/null
+++ b/WebCore/bindings/v8/custom/V8DeviceMotionEventCustom.cpp
@@ -0,0 +1,139 @@
+/*
+ * 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"
+#include "V8DeviceMotionEvent.h"
+
+#if ENABLE(DEVICE_ORIENTATION)
+
+#include "DeviceMotionData.h"
+#include "V8Binding.h"
+#include "V8Proxy.h"
+
+#include <v8.h>
+
+namespace WebCore {
+
+v8::Handle<v8::Value> V8DeviceMotionEvent::xAccelerationAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+    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());
+}
+
+v8::Handle<v8::Value> V8DeviceMotionEvent::yAccelerationAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+    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());
+}
+
+v8::Handle<v8::Value> V8DeviceMotionEvent::zAccelerationAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+    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());
+}
+
+v8::Handle<v8::Value> V8DeviceMotionEvent::xRotationRateAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+    INC_STATS("DOM.DeviceMotionEvent.xRotationRate._get");
+    v8::Handle<v8::Object> holder = info.Holder();
+    DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder);
+    if (!imp->deviceMotionData()->canProvideXRotationRate())
+        return v8::Null();
+    return v8::Number::New(imp->deviceMotionData()->xRotationRate());
+}
+
+v8::Handle<v8::Value> V8DeviceMotionEvent::yRotationRateAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+    INC_STATS("DOM.DeviceMotionEvent.yRotationRate._get");
+    v8::Handle<v8::Object> holder = info.Holder();
+    DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder);
+    if (!imp->deviceMotionData()->canProvideYRotationRate())
+        return v8::Null();
+    return v8::Number::New(imp->deviceMotionData()->yRotationRate());
+}
+
+v8::Handle<v8::Value> V8DeviceMotionEvent::zRotationRateAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+    INC_STATS("DOM.DeviceMotionEvent.zRotationRate._get");
+    v8::Handle<v8::Object> holder = info.Holder();
+    DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder);
+    if (!imp->deviceMotionData()->canProvideZRotationRate())
+        return v8::Null();
+    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");
+    v8::Handle<v8::Object> holder = info.Holder();
+    DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(holder);
+    if (!imp->deviceMotionData()->canProvideInterval())
+        return v8::Null();
+    return v8::Number::New(imp->deviceMotionData()->interval());
+}
+
+v8::Handle<v8::Value> V8DeviceMotionEvent::initDeviceMotionEventCallback(const v8::Arguments& args)
+{
+    DeviceMotionEvent* imp = V8DeviceMotionEvent::toNative(args.Holder());
+    V8Parameter<> type = args[0];
+    bool bubbles = args[1]->BooleanValue();
+    bool cancelable = args[2]->BooleanValue();
+    // 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>();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(DEVICE_ORIENTATION)
diff --git a/WebCore/dom/DeviceMotionClient.h b/WebCore/dom/DeviceMotionClient.h
new file mode 100644
index 0000000..d19f92f
--- /dev/null
+++ b/WebCore/dom/DeviceMotionClient.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright 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.
+ */
+
+#ifndef DeviceMotionClient_h
+#define DeviceMotionClient_h
+
+namespace WebCore {
+
+class DeviceMotionController;
+class DeviceMotionData;
+
+class DeviceMotionClient {
+public:
+    virtual ~DeviceMotionClient() {}
+    virtual void setController(DeviceMotionController*) = 0;
+    virtual void startUpdating() = 0;
+    virtual void stopUpdating() = 0;
+    virtual DeviceMotionData* currentDeviceMotion() const = 0;
+};
+
+} // namespace WebCore
+
+#endif // DeviceMotionClient_h
diff --git a/WebCore/dom/DeviceMotionController.cpp b/WebCore/dom/DeviceMotionController.cpp
new file mode 100644
index 0000000..73b948e
--- /dev/null
+++ b/WebCore/dom/DeviceMotionController.cpp
@@ -0,0 +1,104 @@
+/*
+ * Copyright 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"
+#include "DeviceMotionController.h"
+
+#include "DeviceMotionClient.h"
+#include "DeviceMotionData.h"
+#include "DeviceMotionEvent.h"
+
+namespace WebCore {
+
+DeviceMotionController::DeviceMotionController(DeviceMotionClient* client)
+    : m_client(client)
+    , m_timer(this, &DeviceMotionController::timerFired)
+{
+    ASSERT(m_client);
+    m_client->setController(this);
+}
+
+void DeviceMotionController::timerFired(Timer<DeviceMotionController>* timer)
+{
+    ASSERT_UNUSED(timer, timer == &m_timer);
+    ASSERT(!m_client || m_client->currentDeviceMotion());
+    m_timer.stop();
+    
+    RefPtr<DeviceMotionData> deviceMotionData = m_client ? m_client->currentDeviceMotion() : DeviceMotionData::create();
+    RefPtr<DeviceMotionEvent> event = DeviceMotionEvent::create(eventNames().devicemotionEvent, deviceMotionData.get());
+ 
+    Vector<DOMWindow*> listenersVector;
+    copyToVector(m_newListeners, listenersVector);
+    m_newListeners.clear();
+    for (size_t i = 0; i < listenersVector.size(); ++i)
+        listenersVector[i]->dispatchEvent(event);
+}
+    
+void DeviceMotionController::addListener(DOMWindow* window)
+{
+    // If no client is present or the client already has motion data,
+    // immediately trigger an asynchronous response.
+    if (!m_client || m_client->currentDeviceMotion()) {
+        m_newListeners.add(window);
+        if (!m_timer.isActive())
+            m_timer.startOneShot(0);
+    }
+    
+    bool wasEmpty = m_listeners.isEmpty();
+    m_listeners.add(window);
+    if (wasEmpty && m_client)
+        m_client->startUpdating();
+}
+
+void DeviceMotionController::removeListener(DOMWindow* window)
+{
+    m_listeners.remove(window);
+    m_newListeners.remove(window);
+    if (m_listeners.isEmpty() && m_client)
+        m_client->stopUpdating();
+}
+
+void DeviceMotionController::removeAllListeners(DOMWindow* window)
+{
+    // May be called with a DOMWindow that's not a listener.
+    if (!m_listeners.contains(window))
+        return;
+
+    m_listeners.removeAll(window);
+    m_newListeners.remove(window);
+    if (m_listeners.isEmpty() && m_client)
+        m_client->stopUpdating();
+}
+
+void DeviceMotionController::didChangeDeviceMotion(DeviceMotionData* deviceMotionData)
+{
+    RefPtr<DeviceMotionEvent> event = DeviceMotionEvent::create(eventNames().devicemotionEvent, deviceMotionData);
+    Vector<DOMWindow*> listenersVector;
+    copyToVector(m_listeners, listenersVector);
+    for (size_t i = 0; i < listenersVector.size(); ++i)
+        listenersVector[i]->dispatchEvent(event);
+}
+
+} // namespace WebCore
diff --git a/WebCore/dom/DeviceMotionController.h b/WebCore/dom/DeviceMotionController.h
new file mode 100644
index 0000000..2670e04
--- /dev/null
+++ b/WebCore/dom/DeviceMotionController.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright 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.
+ */
+
+#ifndef DeviceMotionController_h
+#define DeviceMotionController_h
+
+#include "DOMWindow.h"
+#include "Timer.h"
+#include <wtf/HashCountedSet.h>
+
+namespace WebCore {
+
+class DeviceMotionData;
+class DeviceMotionClient;
+
+class DeviceMotionController {
+public:
+    DeviceMotionController(DeviceMotionClient*);
+
+    void addListener(DOMWindow*);
+    void removeListener(DOMWindow*);
+    void removeAllListeners(DOMWindow*);
+
+    void didChangeDeviceMotion(DeviceMotionData*);
+
+private:
+    void timerFired(Timer<DeviceMotionController>*);
+    
+    DeviceMotionClient* m_client;
+    typedef HashCountedSet<DOMWindow*> ListenersCountedSet;
+    ListenersCountedSet m_listeners;
+    typedef HashSet<DOMWindow*> ListenersSet;
+    ListenersSet m_newListeners;
+    Timer<DeviceMotionController> m_timer;
+};
+
+} // namespace WebCore
+
+#endif // DeviceMotionController_h
diff --git a/WebCore/dom/DeviceMotionData.cpp b/WebCore/dom/DeviceMotionData.cpp
new file mode 100644
index 0000000..cf4b466
--- /dev/null
+++ b/WebCore/dom/DeviceMotionData.cpp
@@ -0,0 +1,88 @@
+/*
+ * 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"
+#include "DeviceMotionData.h"
+
+namespace WebCore {
+
+PassRefPtr<DeviceMotionData> DeviceMotionData::create()
+{
+    return adoptRef(new DeviceMotionData);
+}
+
+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(canProvideXAcceleration, xAcceleration,
+                                         canProvideYAcceleration, yAcceleration,
+                                         canProvideZAcceleration, zAcceleration,
+                                         canProvideXRotationRate, xRotationRate,
+                                         canProvideYRotationRate, yRotationRate,
+                                         canProvideZRotationRate, zRotationRate,
+                                         canProvideInterval, interval));
+}
+
+DeviceMotionData::DeviceMotionData()
+    : m_canProvideXAcceleration(false)
+    , m_canProvideYAcceleration(false)
+    , m_canProvideZAcceleration(false)
+    , m_canProvideXRotationRate(false)
+    , m_canProvideYRotationRate(false)
+    , m_canProvideZRotationRate(false)
+    , m_canProvideInterval(false)
+{
+}
+
+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_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)
+{
+}
+
+} // namespace WebCore
diff --git a/WebCore/dom/DeviceMotionData.h b/WebCore/dom/DeviceMotionData.h
new file mode 100644
index 0000000..cd90246
--- /dev/null
+++ b/WebCore/dom/DeviceMotionData.h
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+
+#ifndef DeviceMotionData_h
+#define DeviceMotionData_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class DeviceMotionData : public RefCounted<DeviceMotionData> {
+public:
+    static PassRefPtr<DeviceMotionData> create();
+    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);
+
+    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(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);
+
+    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;
+};
+
+} // namespace WebCore
+
+#endif // DeviceMotionData_h
diff --git a/WebCore/dom/DeviceMotionEvent.cpp b/WebCore/dom/DeviceMotionEvent.cpp
new file mode 100644
index 0000000..860cca2
--- /dev/null
+++ b/WebCore/dom/DeviceMotionEvent.cpp
@@ -0,0 +1,57 @@
+/*
+ * 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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"
+#include "DeviceMotionEvent.h"
+
+#include "DeviceMotionData.h"
+
+namespace WebCore {
+
+DeviceMotionEvent::~DeviceMotionEvent()
+{
+}
+
+DeviceMotionEvent::DeviceMotionEvent()
+    : m_deviceMotionData(DeviceMotionData::create())
+{
+}
+
+DeviceMotionEvent::DeviceMotionEvent(const AtomicString& eventType, DeviceMotionData* deviceMotionData)
+    : Event(eventType, false, false) // Can't bubble, not cancelable
+    , m_deviceMotionData(deviceMotionData)
+{
+}
+
+void DeviceMotionEvent::initDeviceMotionEvent(const AtomicString& type, bool bubbles, bool cancelable, DeviceMotionData* deviceMotionData)
+{
+    if (dispatched())
+        return;
+
+    initEvent(type, bubbles, cancelable);
+    m_deviceMotionData = deviceMotionData;
+}
+
+} // namespace WebCore
diff --git a/WebCore/dom/DeviceMotionEvent.h b/WebCore/dom/DeviceMotionEvent.h
new file mode 100644
index 0000000..f32c93b
--- /dev/null
+++ b/WebCore/dom/DeviceMotionEvent.h
@@ -0,0 +1,62 @@
+/*
+ * 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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. 
+ */
+
+#ifndef DeviceMotionEvent_h
+#define DeviceMotionEvent_h
+
+#include "Event.h"
+
+namespace WebCore {
+
+class DeviceMotionData;
+
+class DeviceMotionEvent : public Event {
+public:
+    ~DeviceMotionEvent();
+    static PassRefPtr<DeviceMotionEvent> create()
+    {
+        return adoptRef(new DeviceMotionEvent);
+    }
+    static PassRefPtr<DeviceMotionEvent> create(const AtomicString& eventType, DeviceMotionData* deviceMotionData)
+    {
+        return adoptRef(new DeviceMotionEvent(eventType, deviceMotionData));
+    }
+
+    void initDeviceMotionEvent(const AtomicString& type, bool bubbles, bool cancelable, DeviceMotionData*);
+
+    virtual bool isDeviceMotionEvent() const { return true; }
+
+    DeviceMotionData* deviceMotionData() const { return m_deviceMotionData.get(); }
+
+private:
+    DeviceMotionEvent();
+    DeviceMotionEvent(const AtomicString& eventType, DeviceMotionData*);
+
+    RefPtr<DeviceMotionData> m_deviceMotionData;
+};
+
+} // namespace WebCore
+
+#endif // DeviceMotionEvent_h
diff --git a/WebCore/dom/DeviceMotionEvent.idl b/WebCore/dom/DeviceMotionEvent.idl
new file mode 100644
index 0000000..97e8e71
--- /dev/null
+++ b/WebCore/dom/DeviceMotionEvent.idl
@@ -0,0 +1,41 @@
+/*
+ * 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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 APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. 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. 
+ */
+
+module core {
+
+    interface [
+        Conditional=DEVICE_ORIENTATION
+    ] DeviceMotionEvent : Event {
+        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 double xAcceleration, in double yAcceleration, in double zAcceleration, in double xRotationRate, in double yRotationRate, in double zRotationRate, in double interval);
+    };
+
+}
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index 97d60ad..8493b0f 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -44,6 +44,7 @@
 #include "CustomEvent.h"
 #include "DOMImplementation.h"
 #include "DOMWindow.h"
+#include "DeviceMotionEvent.h"
 #include "DeviceOrientationEvent.h"
 #include "DocLoader.h"
 #include "DocumentFragment.h"
@@ -3331,6 +3332,8 @@ PassRefPtr<Event> Document::createEvent(const String& eventType, ExceptionCode&
         event = TouchEvent::create();
 #endif
 #if ENABLE(DEVICE_ORIENTATION)
+    else if (eventType == "DeviceMotionEvent")
+        event = DeviceMotionEvent::create();
     else if (eventType == "DeviceOrientationEvent")
         event = DeviceOrientationEvent::create();
 #endif
diff --git a/WebCore/dom/Event.cpp b/WebCore/dom/Event.cpp
index 4ea3e0c..1aab5c7 100644
--- a/WebCore/dom/Event.cpp
+++ b/WebCore/dom/Event.cpp
@@ -213,6 +213,11 @@ bool Event::isTouchEvent() const
 #endif
 
 #if ENABLE(DEVICE_ORIENTATION)
+bool Event::isDeviceMotionEvent() const
+{
+    return false;
+}
+
 bool Event::isDeviceOrientationEvent() const
 {
     return false;
diff --git a/WebCore/dom/Event.h b/WebCore/dom/Event.h
index 2b570d5..e18258c 100644
--- a/WebCore/dom/Event.h
+++ b/WebCore/dom/Event.h
@@ -140,6 +140,7 @@ namespace WebCore {
         virtual bool isTouchEvent() const;
 #endif
 #if ENABLE(DEVICE_ORIENTATION)
+        virtual bool isDeviceMotionEvent() const;
         virtual bool isDeviceOrientationEvent() const;
 #endif
         bool fromUserGesture();
diff --git a/WebCore/dom/EventNames.h b/WebCore/dom/EventNames.h
index 1b97d65..455d6ac 100644
--- a/WebCore/dom/EventNames.h
+++ b/WebCore/dom/EventNames.h
@@ -51,6 +51,7 @@ namespace WebCore {
     macro(copy) \
     macro(cut) \
     macro(dblclick) \
+    macro(devicemotion) \
     macro(deviceorientation) \
     macro(display) \
     macro(downloading) \
diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp
index fc696da..b4789e3 100644
--- a/WebCore/page/DOMWindow.cpp
+++ b/WebCore/page/DOMWindow.cpp
@@ -42,6 +42,7 @@
 #include "DOMTimer.h"
 #include "Database.h"
 #include "DatabaseCallback.h"
+#include "DeviceMotionController.h"
 #include "DeviceOrientationController.h"
 #include "PageTransitionEvent.h"
 #include "Document.h"
@@ -1435,6 +1436,8 @@ bool DOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<Event
     else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadListeners(this))
         addBeforeUnloadEventListener(this);
 #if ENABLE(DEVICE_ORIENTATION)
+    else if (eventType == eventNames().devicemotionEvent && frame() && frame()->page() && frame()->page()->deviceMotionController())
+        frame()->page()->deviceMotionController()->addListener(this);
     else if (eventType == eventNames().deviceorientationEvent && frame() && frame()->page() && frame()->page()->deviceOrientationController())
         frame()->page()->deviceOrientationController()->addListener(this);
 #endif
@@ -1452,6 +1455,8 @@ bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener
     else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadListeners(this))
         removeBeforeUnloadEventListener(this);
 #if ENABLE(DEVICE_ORIENTATION)
+    else if (eventType == eventNames().devicemotionEvent && frame() && frame()->page() && frame()->page()->deviceMotionController())
+        frame()->page()->deviceMotionController()->removeListener(this);
     else if (eventType == eventNames().deviceorientationEvent && frame() && frame()->page() && frame()->page()->deviceOrientationController())
         frame()->page()->deviceOrientationController()->removeListener(this);
 #endif
@@ -1530,6 +1535,8 @@ void DOMWindow::removeAllEventListeners()
     EventTarget::removeAllEventListeners();
 
 #if ENABLE(DEVICE_ORIENTATION)
+    if (frame() && frame()->page() && frame()->page()->deviceMotionController())
+        frame()->page()->deviceMotionController()->removeAllListeners(this);
     if (frame() && frame()->page() && frame()->page()->deviceOrientationController())
         frame()->page()->deviceOrientationController()->removeAllListeners(this);
 #endif
diff --git a/WebCore/page/DOMWindow.h b/WebCore/page/DOMWindow.h
index 51d407c..8d57dcc 100644
--- a/WebCore/page/DOMWindow.h
+++ b/WebCore/page/DOMWindow.h
@@ -338,6 +338,7 @@ namespace WebCore {
 #endif
 
 #if ENABLE(DEVICE_ORIENTATION)
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(devicemotion);
         DEFINE_ATTRIBUTE_EVENT_LISTENER(deviceorientation);
 #endif
 
diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl
index dc1c323..c68f58b 100644
--- a/WebCore/page/DOMWindow.idl
+++ b/WebCore/page/DOMWindow.idl
@@ -305,8 +305,10 @@ module window {
         attribute [Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchend;
         attribute [Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchcancel;
 
-        attribute [Conditional=DEVICE_ORIENTATION, EnabledAtRuntime] DeviceOrientationEventConstructor DeviceOrientationEvent;
-        attribute [Conditional=DEVICE_ORIENTATION, EnabledAtRuntime] EventListener ondeviceorientation;
+        attribute [Conditional=DEVICE_ORIENTATION,EnabledAtRuntime] DeviceMotionEventConstructor DeviceMotionEvent;
+        attribute [Conditional=DEVICE_ORIENTATION,EnabledAtRuntime] EventListener ondevicemotion;
+        attribute [Conditional=DEVICE_ORIENTATION,EnabledAtRuntime] DeviceOrientationEventConstructor DeviceOrientationEvent;
+        attribute [Conditional=DEVICE_ORIENTATION,EnabledAtRuntime] EventListener ondeviceorientation;
 
         // EventTarget interface
         [Custom] void addEventListener(in DOMString type,
diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp
index 94d2940..5ab6425 100644
--- a/WebCore/page/Page.cpp
+++ b/WebCore/page/Page.cpp
@@ -20,6 +20,7 @@
 #include "config.h"
 #include "Page.h"
 
+#include "DeviceMotionController.h"
 #include "BackForwardController.h"
 #include "BackForwardList.h"
 #include "Base64.h"
@@ -141,6 +142,7 @@ Page::Page(const PageClients& pageClients)
     , m_geolocationController(new GeolocationController(this, pageClients.geolocationControllerClient))
 #endif
 #if ENABLE(DEVICE_ORIENTATION)
+    , m_deviceMotionController(RuntimeEnabledFeatures::deviceMotionEnabled() ? new DeviceMotionController(pageClients.deviceMotionClient) : 0)
     , m_deviceOrientationController(RuntimeEnabledFeatures::deviceOrientationEnabled() ? new DeviceOrientationController(this, pageClients.deviceOrientationClient) : 0)
 #endif
 #if ENABLE(INPUT_SPEECH)
diff --git a/WebCore/page/Page.h b/WebCore/page/Page.h
index 62af0a7..d9e9255 100644
--- a/WebCore/page/Page.h
+++ b/WebCore/page/Page.h
@@ -44,6 +44,8 @@ namespace WebCore {
     class ChromeClient;
     class ContextMenuClient;
     class ContextMenuController;
+    class DeviceMotionClient;
+    class DeviceMotionController;
     class DeviceOrientationClient;
     class DeviceOrientationController;
     class Document;
@@ -101,6 +103,7 @@ namespace WebCore {
                 , inspectorClient(0)
                 , pluginHalterClient(0)
                 , geolocationControllerClient(0)
+                , deviceMotionClient(0)
                 , deviceOrientationClient(0)
                 , backForwardControllerClient(0)
                 , speechInputClient(0)
@@ -113,6 +116,7 @@ namespace WebCore {
             InspectorClient* inspectorClient;
             PluginHalterClient* pluginHalterClient;
             GeolocationControllerClient* geolocationControllerClient;
+            DeviceMotionClient* deviceMotionClient;
             DeviceOrientationClient* deviceOrientationClient;
             BackForwardControllerClient* backForwardControllerClient;
             SpeechInputClient* speechInputClient;
@@ -179,6 +183,7 @@ namespace WebCore {
         GeolocationController* geolocationController() const { return m_geolocationController.get(); }
 #endif
 #if ENABLE(DEVICE_ORIENTATION)
+        DeviceMotionController* deviceMotionController() const { return m_deviceMotionController.get(); }
         DeviceOrientationController* deviceOrientationController() const { return m_deviceOrientationController.get(); }
 #endif
 #if ENABLE(INPUT_SPEECH)
@@ -313,6 +318,7 @@ namespace WebCore {
         OwnPtr<GeolocationController> m_geolocationController;
 #endif
 #if ENABLE(DEVICE_ORIENTATION)
+        OwnPtr<DeviceMotionController> m_deviceMotionController;
         OwnPtr<DeviceOrientationController> m_deviceOrientationController;
 #endif
 #if ENABLE(INPUT_SPEECH)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list