Diff
Modified: trunk/LayoutTests/ChangeLog (100859 => 100860)
--- trunk/LayoutTests/ChangeLog 2011-11-19 20:15:12 UTC (rev 100859)
+++ trunk/LayoutTests/ChangeLog 2011-11-19 20:51:42 UTC (rev 100860)
@@ -1,3 +1,16 @@
+2011-11-19 Scott Graham <[email protected]>
+
+ Move gamepad to Modules/ (+ some cleanup)
+ https://bugs.webkit.org/show_bug.cgi?id=72785
+
+ Reviewed by Adam Barth.
+
+ Use standard pre/post js test harness rather than custom one.
+
+ * gamepad/gamepad-api-expected.txt:
+ * gamepad/gamepad-api.html:
+ * gamepad/gamepad-test.js: Removed.
+
2011-11-19 David Barr <[email protected]>
REGRESSION(r98542): Chromium: CSS text is rendered on page
Modified: trunk/LayoutTests/gamepad/gamepad-api-expected.txt (100859 => 100860)
--- trunk/LayoutTests/gamepad/gamepad-api-expected.txt 2011-11-19 20:15:12 UTC (rev 100859)
+++ trunk/LayoutTests/gamepad/gamepad-api-expected.txt 2011-11-19 20:51:42 UTC (rev 100860)
@@ -1,3 +1,5 @@
-EXPECTED (navigator.webkitGamepads !== 'undefined') OK
-END OF TEST
+PASS navigator.webkitGamepads is defined.
+PASS successfullyParsed is true
+
+TEST COMPLETE
Make sure the main polling access point exists on navigator.
Modified: trunk/LayoutTests/gamepad/gamepad-api.html (100859 => 100860)
--- trunk/LayoutTests/gamepad/gamepad-api.html 2011-11-19 20:15:12 UTC (rev 100859)
+++ trunk/LayoutTests/gamepad/gamepad-api.html 2011-11-19 20:51:42 UTC (rev 100860)
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<body>
-<script src=""
+<script src=""
<script>
- testExpected("navigator.webkitGamepads", undefined, "!==");
- endTest();
+ shouldBeDefined("navigator.webkitGamepads");
</script>
+<script src=""
<p>Make sure the main polling access point exists on navigator.</p>
</body>
Deleted: trunk/LayoutTests/gamepad/gamepad-test.js (100859 => 100860)
--- trunk/LayoutTests/gamepad/gamepad-test.js 2011-11-19 20:15:12 UTC (rev 100859)
+++ trunk/LayoutTests/gamepad/gamepad-test.js 2011-11-19 20:51:42 UTC (rev 100860)
@@ -1,126 +0,0 @@
-var console = null;
-var printFullTestDetails = true; // This is optionaly switched of by test whose tested values can differ. (see disableFullTestDetailsPrinting())
-
-logConsole();
-
-if (window.layoutTestController) {
- layoutTestController.dumpAsText();
- layoutTestController.waitUntilDone();
-}
-
-function logConsole()
-{
- if (!console && document.body) {
- console = document.createElement('div');
- document.body.appendChild(console);
- }
- return console;
-}
-
-function testExpected(testFuncString, expected, comparison)
-{
- try {
- var observed = eval(testFuncString);
- } catch (ex) {
- consoleWrite(ex);
- return;
- }
-
- if (comparison === undefined)
- comparison = '==';
-
- var success = false;
- switch (comparison)
- {
- case '<': success = observed < expected; break;
- case '<=': success = observed <= expected; break;
- case '>': success = observed > expected; break;
- case '>=': success = observed >= expected; break;
- case '!=': success = observed != expected; break;
- case '!==': success = observed !== expected; break;
- case '==': success = observed == expected; break;
- case '===': success = observed === expected; break;
- }
-
- reportExpected(success, testFuncString, comparison, expected, observed)
-}
-
-var testNumber = 0;
-
-function reportExpected(success, testFuncString, comparison, expected, observed)
-{
- testNumber++;
-
- var msg = "Test " + testNumber;
-
- if (printFullTestDetails || !success)
- msg = "EXPECTED (<em>" + testFuncString + " </em>" + comparison + " '<em>" + expected + "</em>')";
-
- if (!success)
- msg += ", OBSERVED '<em>" + observed + "</em>'";
-
- logResult(success, msg);
-}
-
-function waitForEventAndEnd(element, eventName, funcString)
-{
- waitForEvent(element, eventName, funcString, true)
-}
-
-function waitForEvent(element, eventName, func, endit)
-{
- function _eventCallback(event)
- {
- consoleWrite("EVENT(" + eventName + ")");
-
- if (func)
- func(event);
-
- if (endit)
- endTest();
- }
-
- element.addEventListener(eventName, _eventCallback);
-}
-
-function waitForEventAndTest(element, eventName, testFuncString, endit)
-{
- function _eventCallback(event)
- {
- logResult(eval(testFuncString), "EVENT(" + eventName + ") TEST(" + testFuncString + ")");
- if (endit)
- endTest();
- }
-
- element.addEventListener(eventName, _eventCallback);
-}
-
-function waitForEventTestAndEnd(element, eventName, testFuncString)
-{
- waitForEventAndTest(element, eventName, testFuncString, true);
-}
-
-var testEnded = false;
-
-function endTest()
-{
- consoleWrite("END OF TEST");
- testEnded = true;
- if (window.layoutTestController)
- layoutTestController.notifyDone();
-}
-
-function logResult(success, text)
-{
- if (success)
- consoleWrite(text + " <span style='color:green'>OK</span>");
- else
- consoleWrite(text + " <span style='color:red'>FAIL</span>");
-}
-
-function consoleWrite(text)
-{
- if (testEnded)
- return;
- logConsole().innerHTML += text + "<br>";
-}
Modified: trunk/Source/WebCore/ChangeLog (100859 => 100860)
--- trunk/Source/WebCore/ChangeLog 2011-11-19 20:15:12 UTC (rev 100859)
+++ trunk/Source/WebCore/ChangeLog 2011-11-19 20:51:42 UTC (rev 100860)
@@ -1,3 +1,34 @@
+2011-11-19 Scott Graham <[email protected]>
+
+ Move gamepad to Modules/ (+ some cleanup)
+ https://bugs.webkit.org/show_bug.cgi?id=72785
+
+ Reviewed by Adam Barth.
+
+ Move main files from page/ to Modules/gamepad/. #include guard the
+ gamepad header inclusions in Navigator.cpp to avoid including for
+ ports that do not enable GAMEPAD.
+
+ * Modules/gamepad/Gamepad.cpp: Renamed from Source/WebCore/page/Gamepad.cpp.
+ (WebCore::Gamepad::Gamepad):
+ (WebCore::Gamepad::axes):
+ (WebCore::Gamepad::buttons):
+ (WebCore::Gamepad::~Gamepad):
+ * Modules/gamepad/Gamepad.h: Renamed from Source/WebCore/page/Gamepad.h.
+ * Modules/gamepad/Gamepad.idl: Renamed from Source/WebCore/page/Gamepad.idl.
+ * Modules/gamepad/GamepadList.cpp: Renamed from Source/WebCore/page/GamepadList.cpp.
+ (WebCore::GamepadList::~GamepadList):
+ (WebCore::GamepadList::set):
+ (WebCore::GamepadList::length):
+ (WebCore::GamepadList::item):
+ * Modules/gamepad/GamepadList.h: Renamed from Source/WebCore/page/GamepadList.h.
+ (WebCore::GamepadList::create):
+ (WebCore::GamepadList::GamepadList):
+ * Modules/gamepad/GamepadList.idl: Renamed from Source/WebCore/page/GamepadList.idl.
+ * WebCore.gyp/WebCore.gyp:
+ * WebCore.gypi:
+ * page/Navigator.cpp:
+
2011-11-19 Sheriff Bot <[email protected]>
Unreviewed, rolling out r100834.
Copied: trunk/Source/WebCore/Modules/gamepad/Gamepad.cpp (from rev 100859, trunk/Source/WebCore/page/Gamepad.cpp) (0 => 100860)
--- trunk/Source/WebCore/Modules/gamepad/Gamepad.cpp (rev 0)
+++ trunk/Source/WebCore/Modules/gamepad/Gamepad.cpp 2011-11-19 20:51:42 UTC (rev 100860)
@@ -0,0 +1,55 @@
+// Copyright (C) 2011, Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 "Gamepad.h"
+
+#if ENABLE(GAMEPAD)
+
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+Gamepad::Gamepad()
+{
+}
+
+void Gamepad::axes(unsigned count, float* data)
+{
+ m_axes.resize(count);
+ std::copy(data, data + count, m_axes.begin());
+}
+
+void Gamepad::buttons(unsigned count, float* data)
+{
+ m_buttons.resize(count);
+ std::copy(data, data + count, m_buttons.begin());
+}
+
+Gamepad::~Gamepad()
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(GAMEPAD)
Copied: trunk/Source/WebCore/Modules/gamepad/Gamepad.h (from rev 100859, trunk/Source/WebCore/page/Gamepad.h) (0 => 100860)
--- trunk/Source/WebCore/Modules/gamepad/Gamepad.h (rev 0)
+++ trunk/Source/WebCore/Modules/gamepad/Gamepad.h 2011-11-19 20:51:42 UTC (rev 100860)
@@ -0,0 +1,73 @@
+// Copyright (C) 2011, Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 Gamepad_h
+#define Gamepad_h
+
+#if ENABLE(GAMEPAD)
+
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class Gamepad: public RefCounted<Gamepad> {
+public:
+ static PassRefPtr<Gamepad> create()
+ {
+ return adoptRef(new Gamepad);
+ }
+ ~Gamepad();
+
+ typedef Vector<float> FloatVector;
+
+ const String& id() const { return m_id; }
+ void id(const String& id) { m_id = id; }
+
+ unsigned index() const { return m_index; }
+ void index(unsigned val) { m_index = val; }
+
+ unsigned long long timestamp() const { return m_timestamp; }
+ void timestamp(unsigned long long val) { m_timestamp = val; }
+
+ const FloatVector& axes() const { return m_axes; }
+ void axes(unsigned count, float* data);
+
+ const FloatVector& buttons() const { return m_buttons; }
+ void buttons(unsigned count, float* data);
+
+private:
+ Gamepad();
+ String m_id;
+ unsigned m_index;
+ unsigned long long m_timestamp;
+ FloatVector m_axes;
+ FloatVector m_buttons;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(GAMEPAD)
+
+#endif // Gamepad_h
Copied: trunk/Source/WebCore/Modules/gamepad/Gamepad.idl (from rev 100859, trunk/Source/WebCore/page/Gamepad.idl) (0 => 100860)
--- trunk/Source/WebCore/Modules/gamepad/Gamepad.idl (rev 0)
+++ trunk/Source/WebCore/Modules/gamepad/Gamepad.idl 2011-11-19 20:51:42 UTC (rev 100860)
@@ -0,0 +1,36 @@
+// Copyright (C) 2011, Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 dom {
+
+ interface [
+ Conditional=GAMEPAD
+ ] Gamepad {
+ readonly attribute DOMString id;
+ readonly attribute unsigned long index;
+ readonly attribute unsigned long long timestamp;
+ readonly attribute float[] axes;
+ readonly attribute float[] buttons;
+ };
+
+}
Copied: trunk/Source/WebCore/Modules/gamepad/GamepadList.cpp (from rev 100859, trunk/Source/WebCore/page/GamepadList.cpp) (0 => 100860)
--- trunk/Source/WebCore/Modules/gamepad/GamepadList.cpp (rev 0)
+++ trunk/Source/WebCore/Modules/gamepad/GamepadList.cpp 2011-11-19 20:51:42 UTC (rev 100860)
@@ -0,0 +1,56 @@
+// Copyright (C) 2011, Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 "GamepadList.h"
+
+#include "Gamepad.h"
+
+#if ENABLE(GAMEPAD)
+
+namespace WebCore {
+
+GamepadList::~GamepadList()
+{
+}
+
+void GamepadList::set(unsigned index, PassRefPtr<Gamepad> gamepad)
+{
+ if (index >= kMaximumGamepads)
+ return;
+ m_items[index] = gamepad;
+}
+
+unsigned GamepadList::length() const
+{
+ return kMaximumGamepads;
+}
+
+Gamepad* GamepadList::item(unsigned index)
+{
+ return index < length() ? m_items[index].get() : 0;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(GAMEPAD)
Copied: trunk/Source/WebCore/Modules/gamepad/GamepadList.h (from rev 100859, trunk/Source/WebCore/page/GamepadList.h) (0 => 100860)
--- trunk/Source/WebCore/Modules/gamepad/GamepadList.h (rev 0)
+++ trunk/Source/WebCore/Modules/gamepad/GamepadList.h 2011-11-19 20:51:42 UTC (rev 100860)
@@ -0,0 +1,57 @@
+// Copyright (C) 2011, Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 GamepadList_h
+#define GamepadList_h
+
+#if ENABLE(GAMEPAD)
+
+#include "Gamepad.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+typedef Vector<RefPtr<Gamepad> > GamepadVector;
+
+class GamepadList : public RefCounted<GamepadList> {
+public:
+ static PassRefPtr<GamepadList> create() { return adoptRef(new GamepadList); }
+ ~GamepadList();
+
+ void set(unsigned index, PassRefPtr<Gamepad>);
+ Gamepad* item(unsigned index);
+ unsigned length() const;
+
+private:
+ enum { kMaximumGamepads = 4 };
+ GamepadList() { }
+ RefPtr<Gamepad> m_items[kMaximumGamepads];
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(GAMEPAD)
+
+#endif // GamepadList_h
Copied: trunk/Source/WebCore/Modules/gamepad/GamepadList.idl (from rev 100859, trunk/Source/WebCore/page/GamepadList.idl) (0 => 100860)
--- trunk/Source/WebCore/Modules/gamepad/GamepadList.idl (rev 0)
+++ trunk/Source/WebCore/Modules/gamepad/GamepadList.idl 2011-11-19 20:51:42 UTC (rev 100860)
@@ -0,0 +1,34 @@
+// Copyright (C) 2011, Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+//
+// 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 dom {
+
+ interface [
+ Conditional=GAMEPAD,
+ HasIndexGetter
+ ] GamepadList {
+ readonly attribute unsigned long length;
+ Gamepad item(in [Optional=CallWithDefaultValue] unsigned long index);
+ };
+
+}
Modified: trunk/Source/WebCore/WebCore.gyp/WebCore.gyp (100859 => 100860)
--- trunk/Source/WebCore/WebCore.gyp/WebCore.gyp 2011-11-19 20:15:12 UTC (rev 100859)
+++ trunk/Source/WebCore/WebCore.gyp/WebCore.gyp 2011-11-19 20:51:42 UTC (rev 100860)
@@ -48,6 +48,7 @@
'webcore_include_dirs': [
'../',
'../..',
+ '../Modules/gamepad',
'../accessibility',
'../accessibility/chromium',
'../bindings',
Modified: trunk/Source/WebCore/WebCore.gypi (100859 => 100860)
--- trunk/Source/WebCore/WebCore.gypi 2011-11-19 20:15:12 UTC (rev 100859)
+++ trunk/Source/WebCore/WebCore.gypi 2011-11-19 20:51:42 UTC (rev 100860)
@@ -1129,6 +1129,8 @@
'svg/properties/SVGTransformListPropertyTearOff.h',
],
'webcore_bindings_idl_files': [
+ 'Modules/gamepad/Gamepad.idl',
+ 'Modules/gamepad/GamepadList.idl',
'css/CSSCharsetRule.idl',
'css/CSSFontFaceRule.idl',
'css/CSSImportRule.idl',
@@ -1402,8 +1404,6 @@
'page/DOMSelection.idl',
'page/DOMWindow.idl',
'page/EventSource.idl',
- 'page/Gamepad.idl',
- 'page/GamepadList.idl',
'page/Geolocation.idl',
'page/Geoposition.idl',
'page/History.idl',
@@ -1667,6 +1667,10 @@
'svg/SVGZoomEvent.idl',
],
'webcore_files': [
+ 'Modules/gamepad/Gamepad.cpp',
+ 'Modules/gamepad/Gamepad.h',
+ 'Modules/gamepad/GamepadList.cpp',
+ 'Modules/gamepad/GamepadList.h',
'accessibility/AXObjectCache.cpp',
'accessibility/AccessibilityARIAGrid.cpp',
'accessibility/AccessibilityARIAGrid.h',
@@ -2951,10 +2955,6 @@
'page/FrameActionScheduler.h',
'page/FrameTree.cpp',
'page/FrameView.cpp',
- 'page/Gamepad.cpp',
- 'page/Gamepad.h',
- 'page/GamepadList.cpp',
- 'page/GamepadList.h',
'page/Geolocation.cpp',
'page/GeolocationController.cpp',
'page/GroupSettings.cpp',
Deleted: trunk/Source/WebCore/page/Gamepad.cpp (100859 => 100860)
--- trunk/Source/WebCore/page/Gamepad.cpp 2011-11-19 20:15:12 UTC (rev 100859)
+++ trunk/Source/WebCore/page/Gamepad.cpp 2011-11-19 20:51:42 UTC (rev 100860)
@@ -1,55 +0,0 @@
-// Copyright (C) 2011, Google Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 "Gamepad.h"
-
-#if ENABLE(GAMEPAD)
-
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-Gamepad::Gamepad()
-{
-}
-
-void Gamepad::axes(unsigned count, float* data)
-{
- m_axes.resize(count);
- std::copy(data, data + count, m_axes.begin());
-}
-
-void Gamepad::buttons(unsigned count, float* data)
-{
- m_buttons.resize(count);
- std::copy(data, data + count, m_buttons.begin());
-}
-
-Gamepad::~Gamepad()
-{
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(GAMEPAD)
Deleted: trunk/Source/WebCore/page/Gamepad.h (100859 => 100860)
--- trunk/Source/WebCore/page/Gamepad.h 2011-11-19 20:15:12 UTC (rev 100859)
+++ trunk/Source/WebCore/page/Gamepad.h 2011-11-19 20:51:42 UTC (rev 100860)
@@ -1,73 +0,0 @@
-// Copyright (C) 2011, Google Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 Gamepad_h
-#define Gamepad_h
-
-#if ENABLE(GAMEPAD)
-
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-class Gamepad: public RefCounted<Gamepad> {
-public:
- static PassRefPtr<Gamepad> create()
- {
- return adoptRef(new Gamepad);
- }
- ~Gamepad();
-
- typedef Vector<float> FloatVector;
-
- const String& id() const { return m_id; }
- void id(const String& id) { m_id = id; }
-
- unsigned index() const { return m_index; }
- void index(unsigned val) { m_index = val; }
-
- unsigned long long timestamp() const { return m_timestamp; }
- void timestamp(unsigned long long val) { m_timestamp = val; }
-
- const FloatVector& axes() const { return m_axes; }
- void axes(unsigned count, float* data);
-
- const FloatVector& buttons() const { return m_buttons; }
- void buttons(unsigned count, float* data);
-
-private:
- Gamepad();
- String m_id;
- unsigned m_index;
- unsigned long long m_timestamp;
- FloatVector m_axes;
- FloatVector m_buttons;
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(GAMEPAD)
-
-#endif // Gamepad_h
Deleted: trunk/Source/WebCore/page/Gamepad.idl (100859 => 100860)
--- trunk/Source/WebCore/page/Gamepad.idl 2011-11-19 20:15:12 UTC (rev 100859)
+++ trunk/Source/WebCore/page/Gamepad.idl 2011-11-19 20:51:42 UTC (rev 100860)
@@ -1,36 +0,0 @@
-// Copyright (C) 2011, Google Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 dom {
-
- interface [
- Conditional=GAMEPAD
- ] Gamepad {
- readonly attribute DOMString id;
- readonly attribute unsigned long index;
- readonly attribute unsigned long long timestamp;
- readonly attribute float[] axes;
- readonly attribute float[] buttons;
- };
-
-}
Deleted: trunk/Source/WebCore/page/GamepadList.cpp (100859 => 100860)
--- trunk/Source/WebCore/page/GamepadList.cpp 2011-11-19 20:15:12 UTC (rev 100859)
+++ trunk/Source/WebCore/page/GamepadList.cpp 2011-11-19 20:51:42 UTC (rev 100860)
@@ -1,56 +0,0 @@
-// Copyright (C) 2011, Google Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 "GamepadList.h"
-
-#include "Gamepad.h"
-
-#if ENABLE(GAMEPAD)
-
-namespace WebCore {
-
-GamepadList::~GamepadList()
-{
-}
-
-void GamepadList::set(unsigned index, PassRefPtr<Gamepad> gamepad)
-{
- if (index >= kMaximumGamepads)
- return;
- m_items[index] = gamepad;
-}
-
-unsigned GamepadList::length() const
-{
- return kMaximumGamepads;
-}
-
-Gamepad* GamepadList::item(unsigned index)
-{
- return index < length() ? m_items[index].get() : 0;
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(GAMEPAD)
Deleted: trunk/Source/WebCore/page/GamepadList.h (100859 => 100860)
--- trunk/Source/WebCore/page/GamepadList.h 2011-11-19 20:15:12 UTC (rev 100859)
+++ trunk/Source/WebCore/page/GamepadList.h 2011-11-19 20:51:42 UTC (rev 100860)
@@ -1,57 +0,0 @@
-// Copyright (C) 2011, Google Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 GamepadList_h
-#define GamepadList_h
-
-#if ENABLE(GAMEPAD)
-
-#include "Gamepad.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-typedef Vector<RefPtr<Gamepad> > GamepadVector;
-
-class GamepadList : public RefCounted<GamepadList> {
-public:
- static PassRefPtr<GamepadList> create() { return adoptRef(new GamepadList); }
- ~GamepadList();
-
- void set(unsigned index, PassRefPtr<Gamepad>);
- Gamepad* item(unsigned index);
- unsigned length() const;
-
-private:
- enum { kMaximumGamepads = 4 };
- GamepadList() { }
- RefPtr<Gamepad> m_items[kMaximumGamepads];
-};
-
-} // namespace WebCore
-
-#endif // ENABLE(GAMEPAD)
-
-#endif // GamepadList_h
Deleted: trunk/Source/WebCore/page/GamepadList.idl (100859 => 100860)
--- trunk/Source/WebCore/page/GamepadList.idl 2011-11-19 20:15:12 UTC (rev 100859)
+++ trunk/Source/WebCore/page/GamepadList.idl 2011-11-19 20:51:42 UTC (rev 100860)
@@ -1,34 +0,0 @@
-// Copyright (C) 2011, Google Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 dom {
-
- interface [
- Conditional=GAMEPAD,
- HasIndexGetter
- ] GamepadList {
- readonly attribute unsigned long length;
- Gamepad item(in [Optional=CallWithDefaultValue] unsigned long index);
- };
-
-}
Modified: trunk/Source/WebCore/page/Navigator.cpp (100859 => 100860)
--- trunk/Source/WebCore/page/Navigator.cpp 2011-11-19 20:15:12 UTC (rev 100859)
+++ trunk/Source/WebCore/page/Navigator.cpp 2011-11-19 20:51:42 UTC (rev 100860)
@@ -32,7 +32,6 @@
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameLoaderClient.h"
-#include "GamepadList.h"
#include "Geolocation.h"
#include "PointerLock.h"
#include "KURL.h"
@@ -46,6 +45,10 @@
#include <wtf/HashSet.h>
#include <wtf/StdLibExtras.h>
+#if ENABLE(GAMEPAD)
+#include "GamepadList.h"
+#endif
+
#if ENABLE(MEDIA_STREAM)
#include "NavigatorUserMediaErrorCallback.h"
#include "NavigatorUserMediaSuccessCallback.h"