2010-05-20 Steve Block <steveblock@google.com>
authorsteveblock@google.com <steveblock@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 May 2010 17:37:43 +0000 (17:37 +0000)
committersteveblock@google.com <steveblock@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 May 2010 17:37:43 +0000 (17:37 +0000)
        Reviewed by Jeremy Orlow.

        Provide bindings for DeviceOrientation
        https://bugs.webkit.org/show_bug.cgi?id=39210

        Adds ENABLE_DEVICE_ORIENTATION to XCode project file, always disabled.

        * Configurations/FeatureDefines.xcconfig:
2010-05-20  Steve Block  <steveblock@google.com>

        Reviewed by Jeremy Orlow.

        Provide bindings for DeviceOrientation
        https://bugs.webkit.org/show_bug.cgi?id=39210

        Adds ENABLE_DEVICE_ORIENTATION to VisualStudio project files, always disabled.

        * win/tools/vsprops/FeatureDefines.vsprops:
        * win/tools/vsprops/FeatureDefinesCairo.vsprops:
2010-05-20  Steve Block  <steveblock@google.com>

        Reviewed by Jeremy Orlow.

        Provide bindings for DeviceOrientation
        https://bugs.webkit.org/show_bug.cgi?id=39210

        Adds ENABLE_DEVICE_ORIENTATION to XCode project file, always disabled.

        * Configurations/FeatureDefines.xcconfig:
2010-05-20  Steve Block  <steveblock@google.com>

        Reviewed by Jeremy Orlow.

        Provide bindings for DeviceOrientation
        https://bugs.webkit.org/show_bug.cgi?id=39210

        Tests: fast/dom/DeviceOrientation/window-property.html
               fast/dom/Window/window-properties-on-device-orientation.html

        Adds bindings for DeviceOrientation as defined in
        http://dev.w3.org/geo/api/spec-source-orientation.html
        This is guarded by ENABLE(DEVICE_ORIENTATION) which is currently disabled on
        all platforms but Android.

        * Android.derived.jscbindings.mk:
        * Android.derived.v8bindings.mk:
        * Android.mk:
        * Configurations/FeatureDefines.xcconfig:
        * DerivedSources.cpp:
        * DerivedSources.make:
        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.pri:
        * WebCore.pro:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSEventCustom.cpp:
        (WebCore::toJS):
        * bindings/v8/custom/V8EventCustom.cpp:
        (WebCore::toV8):
        * dom/DeviceOrientationEvent.cpp: Added.
        (WebCore::DeviceOrientationEvent::DeviceOrientationEvent):
        (WebCore::DeviceOrientationEvent::initDeviceOrientationEvent):
        * dom/DeviceOrientationEvent.h: Added.
        (WebCore::DeviceOrientationEvent::create):
        (WebCore::DeviceOrientationEvent::alpha):
        (WebCore::DeviceOrientationEvent::beta):
        (WebCore::DeviceOrientationEvent::gamma):
        (WebCore::DeviceOrientationEvent::isDeviceOrientationEvent):
        * dom/DeviceOrientationEvent.idl: Added.
        * dom/Event.cpp:
        (WebCore::Event::isDeviceOrientationEvent):
        * dom/Event.h:
        * dom/EventNames.h:
        * page/DOMWindow.h:
        * page/DOMWindow.idl:
2010-05-20  Steve Block  <steveblock@google.com>

        Reviewed by Jeremy Orlow.

        Provide bindings for DeviceOrientation
        https://bugs.webkit.org/show_bug.cgi?id=39210

        Modifies existing fast/dom/Window tests to skip window.ondeviceorientation until
        it is widely supported.
        Adds new fast/dom/Window/window-properties-on-device-orientation.html to test
        type and presence of window.ondeviceorientation.
        Adds new fast/dom/DeviceOrientation directory and initial test.
        Adds all DeviceOrientation tests to all skipped lists.

        * fast/dom/DeviceOrientation: Added.
        * fast/dom/DeviceOrientation/script-tests: Added.
        * fast/dom/DeviceOrientation/script-tests/TEMPLATE.html: Added.
        * fast/dom/DeviceOrientation/script-tests/window-property.js: Added.
        (hasOnDeviceOrientationProperty):
        * fast/dom/DeviceOrientation/window-property-expected.txt: Added.
        * fast/dom/DeviceOrientation/window-property.html: Added.
        * fast/dom/Window/script-tests/window-property-descriptors.js:
        * fast/dom/Window/window-properties-on-device-orientation-expected.txt: Added.
        * fast/dom/Window/window-properties-on-device-orientation.html: Added.
        * fast/dom/Window/window-properties.html:
        * platform/chromium/test_expectations.txt:
        * platform/gtk/Skipped:
        * platform/mac/Skipped:
        * platform/qt/Skipped:
        * platform/win/Skipped:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@59847 268f45cc-cd09-0410-ab3c-d52691b4dbfc

43 files changed:
JavaScriptCore/ChangeLog
JavaScriptCore/Configurations/FeatureDefines.xcconfig
LayoutTests/ChangeLog
LayoutTests/fast/dom/DeviceOrientation/script-tests/TEMPLATE.html [new file with mode: 0644]
LayoutTests/fast/dom/DeviceOrientation/script-tests/window-property.js [new file with mode: 0644]
LayoutTests/fast/dom/DeviceOrientation/window-property-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/DeviceOrientation/window-property.html [new file with mode: 0644]
LayoutTests/fast/dom/Window/script-tests/window-property-descriptors.js
LayoutTests/fast/dom/Window/window-properties-on-device-orientation-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/Window/window-properties-on-device-orientation.html [new file with mode: 0644]
LayoutTests/fast/dom/Window/window-properties.html
LayoutTests/platform/chromium/test_expectations.txt
LayoutTests/platform/gtk/Skipped
LayoutTests/platform/mac/Skipped
LayoutTests/platform/qt/Skipped
LayoutTests/platform/win/Skipped
WebCore/Android.derived.jscbindings.mk
WebCore/Android.derived.v8bindings.mk
WebCore/Android.mk
WebCore/ChangeLog
WebCore/Configurations/FeatureDefines.xcconfig
WebCore/DerivedSources.cpp
WebCore/DerivedSources.make
WebCore/GNUmakefile.am
WebCore/WebCore.gypi
WebCore/WebCore.pri
WebCore/WebCore.pro
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/js/JSEventCustom.cpp
WebCore/bindings/v8/custom/V8EventCustom.cpp
WebCore/dom/DeviceOrientationEvent.cpp [new file with mode: 0644]
WebCore/dom/DeviceOrientationEvent.h [new file with mode: 0644]
WebCore/dom/DeviceOrientationEvent.idl [new file with mode: 0644]
WebCore/dom/Event.cpp
WebCore/dom/Event.h
WebCore/dom/EventNames.h
WebCore/page/DOMWindow.h
WebCore/page/DOMWindow.idl
WebKit/mac/ChangeLog
WebKit/mac/Configurations/FeatureDefines.xcconfig
WebKitLibraries/ChangeLog
WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops
WebKitLibraries/win/tools/vsprops/FeatureDefinesCairo.vsprops

index 8c90d0c..147aed5 100644 (file)
@@ -1,3 +1,14 @@
+2010-05-20  Steve Block  <steveblock@google.com>
+
+        Reviewed by Jeremy Orlow.
+
+        Provide bindings for DeviceOrientation
+        https://bugs.webkit.org/show_bug.cgi?id=39210
+
+        Adds ENABLE_DEVICE_ORIENTATION to XCode project file, always disabled.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2010-05-19  Gavin Barraclough  <barraclough@apple.com>
 
         Reviewed by Geoff Garen.
index 947f371..c64d94c 100644 (file)
@@ -47,6 +47,7 @@ ENABLE_CLIENT_BASED_GEOLOCATION = ENABLE_CLIENT_BASED_GEOLOCATION;
 ENABLE_DATABASE = ENABLE_DATABASE;
 ENABLE_DATAGRID = ;
 ENABLE_DATALIST = ENABLE_DATALIST;
+ENABLE_DEVICE_ORIENTATION = ;
 ENABLE_DOM_STORAGE = ENABLE_DOM_STORAGE;
 ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE;
 ENABLE_FILTERS = ENABLE_FILTERS;
@@ -78,4 +79,4 @@ ENABLE_XHTMLMP = ;
 ENABLE_XPATH = ENABLE_XPATH;
 ENABLE_XSLT = ENABLE_XSLT;
 
-FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
+FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
index 170d710..87f2c68 100644 (file)
@@ -1,3 +1,34 @@
+2010-05-20  Steve Block  <steveblock@google.com>
+
+        Reviewed by Jeremy Orlow.
+
+        Provide bindings for DeviceOrientation
+        https://bugs.webkit.org/show_bug.cgi?id=39210
+
+        Modifies existing fast/dom/Window tests to skip window.ondeviceorientation until
+        it is widely supported.
+        Adds new fast/dom/Window/window-properties-on-device-orientation.html to test
+        type and presence of window.ondeviceorientation.
+        Adds new fast/dom/DeviceOrientation directory and initial test.
+        Adds all DeviceOrientation tests to all skipped lists.
+
+        * fast/dom/DeviceOrientation: Added.
+        * fast/dom/DeviceOrientation/script-tests: Added.
+        * fast/dom/DeviceOrientation/script-tests/TEMPLATE.html: Added.
+        * fast/dom/DeviceOrientation/script-tests/window-property.js: Added.
+        (hasOnDeviceOrientationProperty):
+        * fast/dom/DeviceOrientation/window-property-expected.txt: Added.
+        * fast/dom/DeviceOrientation/window-property.html: Added.
+        * fast/dom/Window/script-tests/window-property-descriptors.js:
+        * fast/dom/Window/window-properties-on-device-orientation-expected.txt: Added.
+        * fast/dom/Window/window-properties-on-device-orientation.html: Added.
+        * fast/dom/Window/window-properties.html:
+        * platform/chromium/test_expectations.txt:
+        * platform/gtk/Skipped:
+        * platform/mac/Skipped:
+        * platform/qt/Skipped:
+        * platform/win/Skipped:
+
 2010-05-20  Martin Robinson  <mrobinson@webkit.org>
 
         Reviewed by Ojan Vafai.
diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/TEMPLATE.html b/LayoutTests/fast/dom/DeviceOrientation/script-tests/TEMPLATE.html
new file mode 100644 (file)
index 0000000..b31963d
--- /dev/null
@@ -0,0 +1,12 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="YOUR_JS_FILE_HERE"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/window-property.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/window-property.js
new file mode 100644 (file)
index 0000000..9a5cc55
--- /dev/null
@@ -0,0 +1,17 @@
+description("Tests that the window.ondeviceorientation property is present.");
+
+function hasOnDeviceOrientationProperty()
+{
+    for (var property in window) {
+        if (property == "ondeviceorientation")
+            return true;
+    }
+    return false;
+}
+
+shouldBeTrue("typeof window.ondeviceorientation == 'object'");
+shouldBeTrue("hasOnDeviceOrientationProperty()");
+shouldBeTrue("'ondeviceorientation' in window");
+shouldBeTrue("window.hasOwnProperty('ondeviceorientation')");
+
+window.successfullyParsed = true;
diff --git a/LayoutTests/fast/dom/DeviceOrientation/window-property-expected.txt b/LayoutTests/fast/dom/DeviceOrientation/window-property-expected.txt
new file mode 100644 (file)
index 0000000..5a0f1d4
--- /dev/null
@@ -0,0 +1,13 @@
+Tests that the window.ondeviceorientation property is present.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS typeof window.ondeviceorientation == 'object' is true
+PASS hasOnDeviceOrientationProperty() is true
+PASS 'ondeviceorientation' in window is true
+PASS window.hasOwnProperty('ondeviceorientation') is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/DeviceOrientation/window-property.html b/LayoutTests/fast/dom/DeviceOrientation/window-property.html
new file mode 100644 (file)
index 0000000..e122033
--- /dev/null
@@ -0,0 +1,12 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/window-property.js"></script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
index 9e34f59..15e4504 100644 (file)
@@ -37,6 +37,7 @@ var __skip__ = {
     "FloatArray" : 1,
     "FileError" : 1,
     "FileReader" : 1,
+    "ondeviceorientation" : 1,
     // Ignore this property because it only appears in debug builds and not in release.
     "jscprint" : 1
 };
diff --git a/LayoutTests/fast/dom/Window/window-properties-on-device-orientation-expected.txt b/LayoutTests/fast/dom/Window/window-properties-on-device-orientation-expected.txt
new file mode 100644 (file)
index 0000000..1dbf392
--- /dev/null
@@ -0,0 +1,4 @@
+This test dumps all of the properties that are reachable from the window.ondeviceorientation object, along with their types.
+
+window.ondeviceorientation [null]
+
diff --git a/LayoutTests/fast/dom/Window/window-properties-on-device-orientation.html b/LayoutTests/fast/dom/Window/window-properties-on-device-orientation.html
new file mode 100644 (file)
index 0000000..2b40485
--- /dev/null
@@ -0,0 +1,94 @@
+<p>This test dumps all of the properties that are reachable from the window.ondeviceorientation
+object, along with their types.</p>
+<hr>
+<pre id="pre"></pre>
+
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+    
+var logBuffer = [];
+function log(s)
+{
+    logBuffer.push(s);
+}
+
+var pre = document.getElementById('pre');
+function flushLog()
+{
+    var logMessage = logBuffer.join("");
+    pre.appendChild(document.createTextNode(logMessage));
+}
+
+function tryEval(string)
+{
+    try {
+        return eval(string);
+    } catch (e) {
+        return new String("Caught exception: " + e);
+    }
+}
+
+function typeOfNullAware(value)
+{
+    if (typeof value == "object" && value == null) //;
+        return "null";
+    return typeof value;
+}
+
+function typeStringNullAware(value)
+{
+    var valueType = typeOfNullAware(value);
+    return valueType == "object"
+        ? Object.prototype.toString.call(value)
+        : "[" + valueType + "]";
+}
+
+function logValue(valueName)
+{
+    var value = tryEval(valueName);
+    var valueType = typeOfNullAware(value);
+
+    // Don't taint the test with our own variables
+    if (value == logBuffer || value == pre)
+        return;
+
+    // Don't taint the test with our own properties
+    if (/__visitedByLogValue__/.test(valueName) || /__nameWhenVisitedByLogValue__/.test(valueName))
+        return;
+
+    // Work around Firefox infinite recursion
+    if (/\.[0-9]/.test(valueName))
+        return;
+
+    // Avoid infinite recursion
+    if (valueType == "object" && value.__visitedByLogValue__) { //;
+        log(valueName + " [printed above as " + value.__nameWhenVisitedByLogValue__ + "]\n");
+        return;
+    }
+
+    log(valueName + " " + typeStringNullAware(value) + "\n");
+
+    if (valueType == "object") {
+        value.__visitedByLogValue__ = true;
+        value.__nameWhenVisitedByLogValue__ = valueName;
+        logProperties(value, valueName);
+    }
+}
+
+function logProperties(object, objectName)
+{
+    var array = new Array;
+    for (var property in object) {
+        array.push(property);
+    }
+    array.sort();
+    for (var i = 0; i < array.length; i++) {
+        var property = array[i];
+        logValue(objectName + "." + property);
+    }
+}
+
+logValue('window.ondeviceorientation');
+flushLog();
+</script>
index da5c61d..ac420e4 100644 (file)
@@ -82,7 +82,8 @@ var __skip__ = {
     "window.clientInformation.geolocation" : 1,
     "window.Blob.prototype.slice" : 1,
     "window.FileError" : 1,
-    "window.FileReader" : 1
+    "window.FileReader" : 1,
+    "window.ondeviceorientation" : 1
 };
 
 function logValue(valueName)
index 5898c9b..e1a67ea 100644 (file)
@@ -2838,3 +2838,7 @@ BUGWK39105 WIN LINUX : editing/spelling/context-menu-suggestions.html = MISSING
 
 // Flaky tests
 BUG44229 WIN LINUX : fast/loader/recursive-before-unload-crash.html = PASS TEXT
+
+// DeviceOrientation API not yet implemented.
+BUG44654 SKIP : fast/dom/DeviceOrientation = TEXT
+BUG44654 SKIP : fast/dom/Window/window-properties-on-device-orientation.html = TEXT
index 34d7471..1700f46 100644 (file)
@@ -1179,6 +1179,7 @@ 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/DeviceOrientation/window-property.html
 fast/dom/Geolocation/callback-exception.html
 fast/dom/Geolocation/error.html
 fast/dom/Geolocation/permission-denied-already-clear-watch.html
@@ -1204,6 +1205,7 @@ fast/dom/SelectorAPI/resig-SelectorsAPI-test.xhtml
 fast/dom/Window/new-window-opener.html
 fast/dom/Window/webkitConvertPoint.html
 fast/dom/Window/window-onFocus.html
+fast/dom/Window/window-properties-on-device-orientation.html
 fast/dom/Window/window-resize-and-move-arguments.html
 fast/dom/Window/window-resize.html
 fast/dom/Window/window-xy-properties.html
index c42068d..6b7ceda 100644 (file)
@@ -188,3 +188,7 @@ scrollbars/scrollbar-click-does-not-blur-content.html
 
 # IndexedDB is not yet enabled.
 storage/indexeddb
+
+# This port doesn't support DeviceOrientation.
+fast/dom/DeviceOrientation
+fast/dom/Window/window-properties-on-device-orientation.html
index 13f904a..646837f 100644 (file)
@@ -5088,3 +5088,7 @@ editing/spelling/context-menu-suggestions.html
 
 # IndexedDB is not yet enabled.
 storage/indexeddb
+
+# This port doesn't support DeviceOrientation.
+fast/dom/DeviceOrientation
+fast/dom/Window/window-properties-on-device-orientation.html
index bdd44d6..02f2a8f 100644 (file)
@@ -883,3 +883,7 @@ editing/spelling/context-menu-suggestions.html
 
 # IndexedDB is not yet enabled.
 storage/indexeddb
+
+# This port doesn't support DeviceOrientation.
+fast/dom/DeviceOrientation
+fast/dom/Window/window-properties-on-device-orientation.html
index 35c9e78..8beb55f 100644 (file)
@@ -49,7 +49,7 @@ js_binding_scripts := $(addprefix $(LOCAL_PATH)/,\
                        bindings/scripts/generate-bindings.pl \
                )
 
-FEATURE_DEFINES := ANDROID_ORIENTATION_SUPPORT ENABLE_TOUCH_EVENTS=1 ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1 ENABLE_DOM_STORAGE=1 ENABLE_VIDEO=1 ENABLE_WORKERS=1 ENABLE_GEOLOCATION=1 ENABLE_CHANNEL_MESSAGING=1
+FEATURE_DEFINES := ANDROID_ORIENTATION_SUPPORT ENABLE_TOUCH_EVENTS=1 ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1 ENABLE_DOM_STORAGE=1 ENABLE_VIDEO=1 ENABLE_WORKERS=1 ENABLE_GEOLOCATION=1 ENABLE_CHANNEL_MESSAGING=1 ENABLE_DEVICE_ORIENTATION=1
 
 # CSS
 GEN := \
@@ -103,6 +103,7 @@ GEN := \
     $(intermediates)/dom/JSComment.h \
     $(intermediates)/dom/JSDOMCoreException.h \
     $(intermediates)/dom/JSDOMImplementation.h \
+    $(intermediates)/dom/JSDeviceOrientationEvent.h \
     $(intermediates)/dom/JSDocument.h \
     $(intermediates)/dom/JSDocumentFragment.h \
     $(intermediates)/dom/JSDocumentType.h \
index bc6435b..bfdafce 100644 (file)
@@ -30,7 +30,8 @@ js_binding_scripts := \
        $(LOCAL_PATH)/bindings/scripts/IDLStructure.pm \
        $(LOCAL_PATH)/bindings/scripts/generate-bindings.pl
 
-FEATURE_DEFINES := ANDROID_ORIENTATION_SUPPORT ENABLE_TOUCH_EVENTS=1 V8_BINDING ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1 ENABLE_DOM_STORAGE=1 ENABLE_VIDEO=1 ENABLE_WORKERS=1 ENABLE_GEOLOCATION=1
+FEATURE_DEFINES := ANDROID_ORIENTATION_SUPPORT ENABLE_TOUCH_EVENTS=1 ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1 ENABLE_DOM_STORAGE=1 ENABLE_VIDEO=1 ENABLE_WORKERS=1 ENABLE_GEOLOCATION=1 ENABLE_DEVICE_ORIENTATION=1
+FEATURE_DEFINES += V8_BINDING
 
 # CSS
 GEN := \
@@ -84,6 +85,7 @@ GEN := \
     $(intermediates)/bindings/V8Comment.h \
     $(intermediates)/bindings/V8DOMCoreException.h \
     $(intermediates)/bindings/V8DOMImplementation.h \
+    $(intermediates)/bindings/V8DeviceOrientationEvent.h \
     $(intermediates)/bindings/V8Document.h \
     $(intermediates)/bindings/V8DocumentFragment.h \
     $(intermediates)/bindings/V8DocumentType.h \
index db9ff4b..32613fd 100644 (file)
@@ -145,6 +145,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
        dom/Notation.cpp \
        dom/OptionElement.cpp \
        dom/OptionGroupElement.cpp \
+       dom/DeviceOrientationEvent.cpp \
        dom/OverflowEvent.cpp \
        dom/PageTransitionEvent.cpp \
        dom/Position.cpp \
index aabca19..b8e9b31 100644 (file)
@@ -1,3 +1,50 @@
+2010-05-20  Steve Block  <steveblock@google.com>
+
+        Reviewed by Jeremy Orlow.
+
+        Provide bindings for DeviceOrientation
+        https://bugs.webkit.org/show_bug.cgi?id=39210
+
+        Tests: fast/dom/DeviceOrientation/window-property.html
+               fast/dom/Window/window-properties-on-device-orientation.html
+
+        Adds bindings for DeviceOrientation as defined in
+        http://dev.w3.org/geo/api/spec-source-orientation.html
+        This is guarded by ENABLE(DEVICE_ORIENTATION) which is currently disabled on
+        all platforms but Android.
+
+        * Android.derived.jscbindings.mk:
+        * Android.derived.v8bindings.mk:
+        * Android.mk:
+        * Configurations/FeatureDefines.xcconfig:
+        * DerivedSources.cpp:
+        * DerivedSources.make:
+        * GNUmakefile.am:
+        * WebCore.gypi:
+        * WebCore.pri:
+        * WebCore.pro:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSEventCustom.cpp:
+        (WebCore::toJS):
+        * bindings/v8/custom/V8EventCustom.cpp:
+        (WebCore::toV8):
+        * dom/DeviceOrientationEvent.cpp: Added.
+        (WebCore::DeviceOrientationEvent::DeviceOrientationEvent):
+        (WebCore::DeviceOrientationEvent::initDeviceOrientationEvent):
+        * dom/DeviceOrientationEvent.h: Added.
+        (WebCore::DeviceOrientationEvent::create):
+        (WebCore::DeviceOrientationEvent::alpha):
+        (WebCore::DeviceOrientationEvent::beta):
+        (WebCore::DeviceOrientationEvent::gamma):
+        (WebCore::DeviceOrientationEvent::isDeviceOrientationEvent):
+        * dom/DeviceOrientationEvent.idl: Added.
+        * dom/Event.cpp:
+        (WebCore::Event::isDeviceOrientationEvent):
+        * dom/Event.h:
+        * dom/EventNames.h:
+        * page/DOMWindow.h:
+        * page/DOMWindow.idl:
+
 2010-05-20  Kenneth Rohde Christiansen  <kenneth.christiansen@openbossa.org>
 
         Rubberstamped by Antti Koivisto.
index 947f371..c64d94c 100644 (file)
@@ -47,6 +47,7 @@ ENABLE_CLIENT_BASED_GEOLOCATION = ENABLE_CLIENT_BASED_GEOLOCATION;
 ENABLE_DATABASE = ENABLE_DATABASE;
 ENABLE_DATAGRID = ;
 ENABLE_DATALIST = ENABLE_DATALIST;
+ENABLE_DEVICE_ORIENTATION = ;
 ENABLE_DOM_STORAGE = ENABLE_DOM_STORAGE;
 ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE;
 ENABLE_FILTERS = ENABLE_FILTERS;
@@ -78,4 +79,4 @@ ENABLE_XHTMLMP = ;
 ENABLE_XPATH = ENABLE_XPATH;
 ENABLE_XSLT = ENABLE_XSLT;
 
-FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
+FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
index 38f9e10..eaf8b7e 100644 (file)
@@ -69,6 +69,7 @@
 #include "JSDataGridColumn.cpp"
 #include "JSDataGridColumnList.cpp"
 #include "JSDedicatedWorkerContext.cpp"
+#include "JSDeviceOrientationEvent.cpp"
 #include "JSDocument.cpp"
 #include "JSDocumentFragment.cpp"
 #include "JSDocumentType.cpp"
index 814db0b..f483d6d 100644 (file)
@@ -117,6 +117,7 @@ DOM_CLASSES = \
     Database \
     DatabaseCallback \
     DatabaseSync \
+    DeviceOrientationEvent \
     Document \
     DocumentFragment \
     DocumentType \
index 0eb93bc..79509be 100644 (file)
@@ -138,6 +138,7 @@ IDL_BINDINGS += \
        Webcore/dom/CustomEvent.idl \
        WebCore/dom/DOMCoreException.idl \
        WebCore/dom/DOMImplementation.idl \
+       WebCore/dom/DeviceOrientationEvent.idl \
        WebCore/dom/Document.idl \
        WebCore/dom/DocumentFragment.idl \
        WebCore/dom/DocumentType.idl \
@@ -765,6 +766,8 @@ webcore_sources += \
        WebCore/dom/DOMCoreException.h \
        WebCore/dom/DOMImplementation.cpp \
        WebCore/dom/DOMImplementation.h \
+       WebCore/dom/DeviceOrientationEvent.cpp \
+       WebCore/dom/DeviceOrientationEvent.h \
        WebCore/dom/Document.cpp \
        WebCore/dom/Document.h \
        WebCore/dom/DocumentFragment.cpp \
index 87bee7a..3345e4d 100644 (file)
@@ -40,6 +40,7 @@
             'dom/CustomEvent.idl',
             'dom/DOMCoreException.idl',
             'dom/DOMImplementation.idl',
+            'dom/DeviceOrientationEvent.idl',
             'dom/Document.idl',
             'dom/DocumentFragment.idl',
             'dom/DocumentType.idl',
             'dom/DOMCoreException.h',
             'dom/DOMImplementation.cpp',
             'dom/DOMImplementation.h',
+            'dom/DeviceOrientationEvent.cpp',
+            'dom/DeviceOrientationEvent.h',
             'dom/Document.cpp',
             'dom/Document.h',
             'dom/DocumentFragment.cpp',
index 4da1aa8..6589ad9 100644 (file)
@@ -260,6 +260,7 @@ IDL_BINDINGS += \
     dom/Comment.idl \
     dom/CompositionEvent.idl \
     dom/CustomEvent.idl \
+    dom/DeviceOrientationEvent.idl \
     dom/DocumentFragment.idl \
     dom/Document.idl \
     dom/DocumentType.idl \
index a2db8c7..7642d90 100644 (file)
@@ -462,6 +462,7 @@ SOURCES += \
     dom/ContainerNode.cpp \
     dom/CSSMappedAttributeDeclaration.cpp \
     dom/CustomEvent.cpp \
+    dom/DeviceOrientationEvent.cpp \
     dom/Document.cpp \
     dom/DocumentFragment.cpp \
     dom/DocumentType.cpp \
@@ -1187,6 +1188,7 @@ HEADERS += \
     dom/CSSMappedAttributeDeclaration.h \
     dom/CustomEvent.h \
     dom/default/PlatformMessagePortChannel.h \
+    dom/DeviceOrientationEvent.h \
     dom/DocumentFragment.h \
     dom/Document.h \
     dom/DocumentType.h \
index cab1475..b9087bb 100644 (file)
                596229781133EFD700DC4CBB /* GeolocationPositionCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 596229771133EFD700DC4CBB /* GeolocationPositionCache.cpp */; };
                5962297A1133EFE200DC4CBB /* GeolocationPositionCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 596229791133EFE200DC4CBB /* GeolocationPositionCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
                599E759011055A1F00D904FA /* Bridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 599E758F11055A1F00D904FA /* Bridge.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               59A85EA2119D68D900DEF1EF /* DeviceOrientationEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59A85EA1119D68D900DEF1EF /* DeviceOrientationEvent.cpp */; };
+               59A85EA4119D68EC00DEF1EF /* DeviceOrientationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A85EA3119D68EC00DEF1EF /* DeviceOrientationEvent.h */; };
+               59A86006119DAF7F00DEF1EF /* JSDeviceOrientationEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59A86005119DAF7F00DEF1EF /* JSDeviceOrientationEvent.cpp */; };
+               59A86008119DAFA100DEF1EF /* JSDeviceOrientationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A86007119DAFA100DEF1EF /* JSDeviceOrientationEvent.h */; };
                59A9E7B01104758800DFB4C1 /* JavaInstanceJSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59A9E7AF1104758800DFB4C1 /* JavaInstanceJSC.cpp */; };
                59A9E7B21104759400DFB4C1 /* JavaInstanceJSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A9E7B11104759400DFB4C1 /* JavaInstanceJSC.h */; };
                59B597731108656B007159E8 /* BridgeJSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59B597721108656B007159E8 /* BridgeJSC.cpp */; };
                596229771133EFD700DC4CBB /* GeolocationPositionCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationPositionCache.cpp; sourceTree = "<group>"; };
                596229791133EFE200DC4CBB /* GeolocationPositionCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationPositionCache.h; sourceTree = "<group>"; };
                599E758F11055A1F00D904FA /* Bridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Bridge.h; path = bridge/Bridge.h; sourceTree = "<group>"; };
+               59A85EA1119D68D900DEF1EF /* DeviceOrientationEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceOrientationEvent.cpp; sourceTree = "<group>"; };
+               59A85EA3119D68EC00DEF1EF /* DeviceOrientationEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceOrientationEvent.h; sourceTree = "<group>"; };
+               59A85EAA119D7B6E00DEF1EF /* DeviceOrientationEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DeviceOrientationEvent.idl; sourceTree = "<group>"; };
+               59A86005119DAF7F00DEF1EF /* JSDeviceOrientationEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeviceOrientationEvent.cpp; sourceTree = "<group>"; };
+               59A86007119DAFA100DEF1EF /* JSDeviceOrientationEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDeviceOrientationEvent.h; sourceTree = "<group>"; };
                59A9E7AF1104758800DFB4C1 /* JavaInstanceJSC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JavaInstanceJSC.cpp; path = jsc/JavaInstanceJSC.cpp; sourceTree = "<group>"; };
                59A9E7B11104759400DFB4C1 /* JavaInstanceJSC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JavaInstanceJSC.h; path = jsc/JavaInstanceJSC.h; sourceTree = "<group>"; };
                59B597721108656B007159E8 /* BridgeJSC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BridgeJSC.cpp; path = bridge/jsc/BridgeJSC.cpp; sourceTree = "<group>"; };
                A83B79100CCB001B000B0825 /* Core */ = {
                        isa = PBXGroup;
                        children = (
+                               59A86007119DAFA100DEF1EF /* JSDeviceOrientationEvent.h */,
+                               59A86005119DAF7F00DEF1EF /* JSDeviceOrientationEvent.cpp */,
                                65DF31D809D1C122000BE325 /* JSAttr.cpp */,
                                65DF31D909D1C123000BE325 /* JSAttr.h */,
                                93F9B79E0BA6032600854064 /* JSCDATASection.cpp */,
                F523D32402DE4478018635CA /* dom */ = {
                        isa = PBXGroup;
                        children = (
+                               59A85EAA119D7B6E00DEF1EF /* DeviceOrientationEvent.idl */,
+                               59A85EA3119D68EC00DEF1EF /* DeviceOrientationEvent.h */,
+                               59A85EA1119D68D900DEF1EF /* DeviceOrientationEvent.cpp */,
                                E1C4DE6D0EA75C650023CCD6 /* ActiveDOMObject.cpp */,
                                E1C4DE680EA75C1E0023CCD6 /* ActiveDOMObject.h */,
                                A8C4A7FC09D563270003AC8D /* Attr.cpp */,
                                97E8B3C311A2890800169409 /* HTML5Token.h in Headers */,
                                A871038B11A2947000DBD50E /* HTML5Tokenizer.h in Headers */,
                                51327D6011A33A2B004F9D65 /* SinkDocument.h in Headers */,
+                               59A85EA4119D68EC00DEF1EF /* DeviceOrientationEvent.h in Headers */,
+                               59A86008119DAFA100DEF1EF /* JSDeviceOrientationEvent.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                97E8B35611A23CE200169409 /* HTML5Lexer.cpp in Sources */,
                                A871038A11A2947000DBD50E /* HTML5Tokenizer.cpp in Sources */,
                                51327D6111A33A2B004F9D65 /* SinkDocument.cpp in Sources */,
+                               59A85EA2119D68D900DEF1EF /* DeviceOrientationEvent.cpp in Sources */,
+                               59A86006119DAF7F00DEF1EF /* JSDeviceOrientationEvent.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index e5fdbe7..bc69323 100644 (file)
 #include "Clipboard.h"
 #include "CompositionEvent.h"
 #include "CustomEvent.h"
+#include "DeviceOrientationEvent.h"
 #include "Event.h"
 #include "JSBeforeLoadEvent.h"
 #include "JSClipboard.h"
 #include "JSCustomEvent.h"
 #include "JSCompositionEvent.h"
+#include "JSDeviceOrientationEvent.h"
 #include "JSErrorEvent.h"
 #if ENABLE(INDEXED_DATABASE)
 #include "JSIDBErrorEvent.h"
@@ -171,6 +173,10 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Event* event)
         wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, PopStateEvent, event);
     else if (event->isCustomEvent())
         wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, CustomEvent, event);
+#if ENABLE(DEVICE_ORIENTATION)
+    else if (event->isDeviceOrientationEvent())
+        wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, DeviceOrientationEvent, event);
+#endif
     else
         wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, Event, event);
 
index 8a1a339..bce1561 100644 (file)
@@ -40,6 +40,7 @@
 #include "V8Clipboard.h"
 #include "V8CompositionEvent.h"
 #include "V8CustomEvent.h"
+#include "V8DeviceOrientationEvent.h"
 #include "V8ErrorEvent.h"
 #include "V8IDBErrorEvent.h"
 #include "V8IDBSuccessEvent.h"
@@ -153,6 +154,10 @@ v8::Handle<v8::Value> toV8(Event* impl)
 #endif
     if (impl->isBeforeLoadEvent())
         return toV8(static_cast<BeforeLoadEvent*>(impl));
+#if ENABLE(DEVICE_ORIENTATION)
+    if (impl->isDeviceOrientationEvent())
+        return toV8(static_cast<DeviceOrientationEvent*>(impl));
+#endif
     if (impl->isCustomEvent())
         return toV8(static_cast<CustomEvent*>(impl));
     return V8Event::wrap(impl);
diff --git a/WebCore/dom/DeviceOrientationEvent.cpp b/WebCore/dom/DeviceOrientationEvent.cpp
new file mode 100644 (file)
index 0000000..b1aae65
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2010, The Android Open Source Project
+ *
+ * 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 "DeviceOrientationEvent.h"
+
+#if ENABLE(DEVICE_ORIENTATION)
+
+namespace WebCore {
+
+DeviceOrientationEvent::DeviceOrientationEvent()
+    : m_alpha(0)
+    , m_beta(0)
+    , m_gamma(0)
+{
+}
+
+DeviceOrientationEvent::DeviceOrientationEvent(const AtomicString& eventType, double alpha, double beta, double gamma)
+    : Event(eventType, false, false) // Can't bubble, not cancelable
+    , m_alpha(alpha)
+    , m_beta(beta)
+    , m_gamma(gamma)
+{
+}
+
+void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& eventType, bool canBubble, bool cancelable, double alpha, double beta, double gamma)
+{
+    if (dispatched())
+        return;
+
+    initEvent(eventType, canBubble, cancelable);
+
+    m_alpha = alpha;
+    m_beta = beta;
+    m_gamma = gamma;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(DEVICE_ORIENTATION)
diff --git a/WebCore/dom/DeviceOrientationEvent.h b/WebCore/dom/DeviceOrientationEvent.h
new file mode 100644 (file)
index 0000000..0cec9ba
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2010, The Android Open Source Project
+ *
+ * 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 DeviceOrientationEvent_h
+#define DeviceOrientationEvent_h
+
+#include "DOMWindow.h"
+#include "Event.h"
+
+namespace WebCore {
+
+class DeviceOrientationEvent : public Event {
+public:
+    static PassRefPtr<DeviceOrientationEvent> create()
+    {
+        return adoptRef(new DeviceOrientationEvent);
+    }
+    static PassRefPtr<DeviceOrientationEvent> create(const AtomicString& eventType, double alpha, double beta, double gamma)
+    {
+        return adoptRef(new DeviceOrientationEvent(eventType, alpha, beta, gamma));
+    }
+
+    void initDeviceOrientationEvent(const AtomicString& eventType, bool canBubble, bool cancelable, double alpha, double beta, double gamma);
+    double alpha() const { return m_alpha; }
+    double beta() const { return m_beta; }
+    double gamma() const { return m_gamma; }
+
+    virtual bool isDeviceOrientationEvent() const { return true; }
+
+private:
+    DeviceOrientationEvent();
+    DeviceOrientationEvent(const AtomicString& eventType, double alpha, double beta, double gamma);
+
+    double m_alpha;
+    double m_beta;
+    double m_gamma;
+};
+
+} // namespace WebCore
+
+#endif // DeviceOrientationEvent_h
diff --git a/WebCore/dom/DeviceOrientationEvent.idl b/WebCore/dom/DeviceOrientationEvent.idl
new file mode 100644 (file)
index 0000000..95d96ec
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2010, The Android Open Source Project
+ *
+ * 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.
+ */
+
+module core {
+
+    interface [
+        Conditional=DEVICE_ORIENTATION
+    ] DeviceOrientationEvent : Event {
+        readonly attribute double alpha;
+        readonly attribute double beta;
+        readonly attribute double gamma;
+        void initDeviceOrientationEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in double alpha, in double beta, in double gamma);
+    };
+
+}
index 876f8a8..4ea3e0c 100644 (file)
@@ -212,6 +212,13 @@ bool Event::isTouchEvent() const
 }
 #endif
 
+#if ENABLE(DEVICE_ORIENTATION)
+bool Event::isDeviceOrientationEvent() const
+{
+    return false;
+}
+#endif
+
 bool Event::fromUserGesture()
 {
     if (!UserGestureIndicator::processingUserGesture())
index fbcdc94..2b570d5 100644 (file)
@@ -139,6 +139,9 @@ namespace WebCore {
 #if ENABLE(TOUCH_EVENTS)
         virtual bool isTouchEvent() const;
 #endif
+#if ENABLE(DEVICE_ORIENTATION)
+        virtual bool isDeviceOrientationEvent() const;
+#endif
         bool fromUserGesture();
         
         bool propagationStopped() const { return m_propagationStopped || m_immediatePropagationStopped; }
index 015f3a4..6ccecef 100644 (file)
@@ -49,6 +49,7 @@ namespace WebCore {
     macro(copy) \
     macro(cut) \
     macro(dblclick) \
+    macro(deviceorientation) \
     macro(display) \
     macro(downloading) \
     macro(drag) \
index e4aa4cb..a1f40a8 100644 (file)
@@ -325,6 +325,10 @@ namespace WebCore {
         DEFINE_ATTRIBUTE_EVENT_LISTENER(orientationchange);
 #endif
 
+#if ENABLE(DEVICE_ORIENTATION)
+        DEFINE_ATTRIBUTE_EVENT_LISTENER(deviceorientation);
+#endif
+
         DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationstart, webkitAnimationStart);
         DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationiteration, webkitAnimationIteration);
         DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationend, webkitAnimationEnd);
index 4cbd60d..380da9e 100644 (file)
@@ -299,6 +299,8 @@ module window {
         attribute [Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchend;
         attribute [Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchcancel;
 
+        attribute [Conditional=DEVICE_ORIENTATION] EventListener ondeviceorientation;
+
         // EventTarget interface
         [Custom] void addEventListener(in DOMString type,
                                       in EventListener listener,
index a3fa427..260f831 100644 (file)
@@ -1,3 +1,14 @@
+2010-05-20  Steve Block  <steveblock@google.com>
+
+        Reviewed by Jeremy Orlow.
+
+        Provide bindings for DeviceOrientation
+        https://bugs.webkit.org/show_bug.cgi?id=39210
+
+        Adds ENABLE_DEVICE_ORIENTATION to XCode project file, always disabled.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2010-05-20  Martin Robinson  <mrobinson@webkit.org>
 
         Reviewed by Ojan Vafai.
index 947f371..c64d94c 100644 (file)
@@ -47,6 +47,7 @@ ENABLE_CLIENT_BASED_GEOLOCATION = ENABLE_CLIENT_BASED_GEOLOCATION;
 ENABLE_DATABASE = ENABLE_DATABASE;
 ENABLE_DATAGRID = ;
 ENABLE_DATALIST = ENABLE_DATALIST;
+ENABLE_DEVICE_ORIENTATION = ;
 ENABLE_DOM_STORAGE = ENABLE_DOM_STORAGE;
 ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE;
 ENABLE_FILTERS = ENABLE_FILTERS;
@@ -78,4 +79,4 @@ ENABLE_XHTMLMP = ;
 ENABLE_XPATH = ENABLE_XPATH;
 ENABLE_XSLT = ENABLE_XSLT;
 
-FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
+FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_BLOB_SLICE) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_FILE_READER) $(ENABLE_FILE_WRITER) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_MATHML) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_PROGRESS_TAG) $(ENABLE_RUBY) $(ENABLE_SANDBOX) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XHTMLMP) $(ENABLE_XPATH) $(ENABLE_XSLT);
index ce443c0..83297ec 100644 (file)
@@ -1,3 +1,15 @@
+2010-05-20  Steve Block  <steveblock@google.com>
+
+        Reviewed by Jeremy Orlow.
+
+        Provide bindings for DeviceOrientation
+        https://bugs.webkit.org/show_bug.cgi?id=39210
+
+        Adds ENABLE_DEVICE_ORIENTATION to VisualStudio project files, always disabled.
+
+        * win/tools/vsprops/FeatureDefines.vsprops:
+        * win/tools/vsprops/FeatureDefinesCairo.vsprops:
+
 2010-04-09  Alexey Proskuryakov  <ap@apple.com>
 
         Reviewed by Maciej Stachowiak.
index 2184f46..02ee348 100644 (file)
@@ -9,7 +9,7 @@
        >
   <Tool
                Name="VCCLCompilerTool"
-               PreprocessorDefinitions="$(ENABLE_3D_CANVAS);$(ENABLE_3D_RENDERING);$(ENABLE_BLOB_SLICE);$(ENABLE_CHANNEL_MESSAGING);$(ENABLE_CLIENT_BASED_GEOLOCATION);$(ENABLE_DATABASE);$(ENABLE_DATAGRID);$(ENABLE_DATALIST);$(ENABLE_DOM_STORAGE);$(ENABLE_EVENTSOURCE);$(ENABLE_FILTERS);$(ENABLE_FILE_READER);$(ENABLE_FILE_WRITER);$(ENABLE_GEOLOCATION);$(ENABLE_ICONDATABASE);$(ENABLE_INDEXED_DATABASE);$(ENABLE_JAVASCRIPT_DEBUGGER);$(ENABLE_MATHML);$(ENABLE_NOTIFICATIONS);$(ENABLE_OFFLINE_WEB_APPLICATIONS);$(ENABLE_RUBY);$(ENABLE_SANDBOX);$(ENABLE_SHARED_WORKERS);$(ENABLE_SVG);$(ENABLE_SVG_ANIMATION);$(ENABLE_SVG_AS_IMAGE);$(ENABLE_SVG_DOM_OBJC_BINDINGS);$(ENABLE_SVG_FONTS);$(ENABLE_SVG_FOREIGN_OBJECT);$(ENABLE_SVG_USE);$(ENABLE_VIDEO);$(ENABLE_WEB_SOCKETS);$(ENABLE_WML);$(ENABLE_WORKERS);$(ENABLE_XHTMLMP);$(ENABLE_XPATH);$(ENABLE_XSLT)"
+               PreprocessorDefinitions="$(ENABLE_3D_CANVAS);$(ENABLE_3D_RENDERING);$(ENABLE_BLOB_SLICE);$(ENABLE_CHANNEL_MESSAGING);$(ENABLE_CLIENT_BASED_GEOLOCATION);$(ENABLE_DATABASE);$(ENABLE_DATAGRID);$(ENABLE_DATALIST);$(ENABLE_DEVICE_ORIENTATION);$(ENABLE_DOM_STORAGE);$(ENABLE_EVENTSOURCE);$(ENABLE_FILTERS);$(ENABLE_FILE_READER);$(ENABLE_FILE_WRITER);$(ENABLE_GEOLOCATION);$(ENABLE_ICONDATABASE);$(ENABLE_INDEXED_DATABASE);$(ENABLE_JAVASCRIPT_DEBUGGER);$(ENABLE_MATHML);$(ENABLE_NOTIFICATIONS);$(ENABLE_OFFLINE_WEB_APPLICATIONS);$(ENABLE_RUBY);$(ENABLE_SANDBOX);$(ENABLE_SHARED_WORKERS);$(ENABLE_SVG);$(ENABLE_SVG_ANIMATION);$(ENABLE_SVG_AS_IMAGE);$(ENABLE_SVG_DOM_OBJC_BINDINGS);$(ENABLE_SVG_FONTS);$(ENABLE_SVG_FOREIGN_OBJECT);$(ENABLE_SVG_USE);$(ENABLE_VIDEO);$(ENABLE_WEB_SOCKETS);$(ENABLE_WML);$(ENABLE_WORKERS);$(ENABLE_XHTMLMP);$(ENABLE_XPATH);$(ENABLE_XSLT)"
        />
   <UserMacro
                Name="ENABLE_3D_CANVAS"
                PerformEnvironmentSet="true"
        />
   <UserMacro
+               Name="ENABLE_DEVICE_ORIENTATION"
+               Value=""
+               PerformEnvironmentSet="true"
+       />
+  <UserMacro
                Name="ENABLE_DOM_STORAGE"
                Value="ENABLE_DOM_STORAGE"
                PerformEnvironmentSet="true"
index 14644d4..cf97a9f 100644 (file)
@@ -9,7 +9,7 @@
        >
   <Tool
                Name="VCCLCompilerTool"
-               PreprocessorDefinitions="$(ENABLE_3D_CANVAS);$(ENABLE_3D_RENDERING);$(ENABLE_BLOB_SLICE);$(ENABLE_CHANNEL_MESSAGING);$(ENABLE_CLIENT_BASED_GEOLOCATION);$(ENABLE_DATABASE);$(ENABLE_DATAGRID);$(ENABLE_DATALIST);$(ENABLE_DOM_STORAGE);$(ENABLE_EVENTSOURCE);$(ENABLE_FILTERS);$(ENABLE_FILE_READER);$(ENABLE_FILE_WRITER);$(ENABLE_GEOLOCATION);$(ENABLE_ICONDATABASE);$(ENABLE_INDEXED_DATABASE);$(ENABLE_JAVASCRIPT_DEBUGGER);$(ENABLE_MATHML);$(ENABLE_NOTIFICATIONS);$(ENABLE_OFFLINE_WEB_APPLICATIONS);$(ENABLE_SHARED_WORKERS);$(ENABLE_SVG);$(ENABLE_SVG_ANIMATION);$(ENABLE_SVG_AS_IMAGE);$(ENABLE_SVG_DOM_OBJC_BINDINGS);$(ENABLE_SVG_FONTS);$(ENABLE_SVG_FOREIGN_OBJECT);$(ENABLE_SVG_USE);$(ENABLE_VIDEO);$(ENABLE_WEB_SOCKETS);$(ENABLE_WML);$(ENABLE_WORKERS);$(ENABLE_XHTMLMP);$(ENABLE_XPATH);$(ENABLE_XSLT)"
+               PreprocessorDefinitions="$(ENABLE_3D_CANVAS);$(ENABLE_3D_RENDERING);$(ENABLE_BLOB_SLICE);$(ENABLE_CHANNEL_MESSAGING);$(ENABLE_CLIENT_BASED_GEOLOCATION);$(ENABLE_DATABASE);$(ENABLE_DATAGRID);$(ENABLE_DATALIST);$(ENABLE_DEVICE_ORIENTATION);$(ENABLE_DOM_STORAGE);$(ENABLE_EVENTSOURCE);$(ENABLE_FILTERS);$(ENABLE_FILE_READER);$(ENABLE_FILE_WRITER);$(ENABLE_GEOLOCATION);$(ENABLE_ICONDATABASE);$(ENABLE_INDEXED_DATABASE);$(ENABLE_JAVASCRIPT_DEBUGGER);$(ENABLE_MATHML);$(ENABLE_NOTIFICATIONS);$(ENABLE_OFFLINE_WEB_APPLICATIONS);$(ENABLE_SHARED_WORKERS);$(ENABLE_SVG);$(ENABLE_SVG_ANIMATION);$(ENABLE_SVG_AS_IMAGE);$(ENABLE_SVG_DOM_OBJC_BINDINGS);$(ENABLE_SVG_FONTS);$(ENABLE_SVG_FOREIGN_OBJECT);$(ENABLE_SVG_USE);$(ENABLE_VIDEO);$(ENABLE_WEB_SOCKETS);$(ENABLE_WML);$(ENABLE_WORKERS);$(ENABLE_XHTMLMP);$(ENABLE_XPATH);$(ENABLE_XSLT)"
        />
   <UserMacro
                Name="ENABLE_3D_CANVAS"
                PerformEnvironmentSet="true"
        />
   <UserMacro
+               Name="ENABLE_DEVICE_ORIENTATION"
+               Value=""
+               PerformEnvironmentSet="true"
+       />
+  <UserMacro
                Name="ENABLE_DOM_STORAGE"
                Value="ENABLE_DOM_STORAGE"
                PerformEnvironmentSet="true"