Title: [123937] trunk
Revision
123937
Author
[email protected]
Date
2012-07-27 16:51:48 -0700 (Fri, 27 Jul 2012)

Log Message

Change navigator.webkitGamepads[] to navigator.webkitGetGamepads()
https://bugs.webkit.org/show_bug.cgi?id=92533

Patch by Scott Graham <[email protected]> on 2012-07-27
Reviewed by Adam Barth.

Source/WebCore:

Per discussion on public-webapps. Pages that enumerate navigator were
causing background resources to be created to poll hardware
unintentionally. By changing to an explicit function call, this is
avoided (and the API becomes more clear too). This change updates the
implementation to match the current ED spec.

* Modules/gamepad/NavigatorGamepad.cpp:
(WebCore::NavigatorGamepad::webkitGetGamepads):
* Modules/gamepad/NavigatorGamepad.h:
(NavigatorGamepad):
* Modules/gamepad/NavigatorGamepad.idl:
* bindings/generic/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setWebkitGetGamepadsEnabled):
(WebCore::RuntimeEnabledFeatures::webkitGetGamepadsEnabled):

Source/WebKit/chromium:

Renames for updated access point.

* src/WebRuntimeFeatures.cpp:
(WebKit::WebRuntimeFeatures::enableGamepad):
(WebKit::WebRuntimeFeatures::isGamepadEnabled):

LayoutTests:

Updates for renamed access point.

* gamepad/gamepad-api-expected.txt:
* gamepad/gamepad-api.html:
* gamepad/gamepad-polling-access-expected.txt:
* gamepad/gamepad-polling-access.html:
* platform/chromium/fast/dom/navigator-detached-no-crash-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (123936 => 123937)


--- trunk/LayoutTests/ChangeLog	2012-07-27 23:44:27 UTC (rev 123936)
+++ trunk/LayoutTests/ChangeLog	2012-07-27 23:51:48 UTC (rev 123937)
@@ -1,3 +1,18 @@
+2012-07-27  Scott Graham  <[email protected]>
+
+        Change navigator.webkitGamepads[] to navigator.webkitGetGamepads()
+        https://bugs.webkit.org/show_bug.cgi?id=92533
+
+        Reviewed by Adam Barth.
+
+        Updates for renamed access point.
+
+        * gamepad/gamepad-api-expected.txt:
+        * gamepad/gamepad-api.html:
+        * gamepad/gamepad-polling-access-expected.txt:
+        * gamepad/gamepad-polling-access.html:
+        * platform/chromium/fast/dom/navigator-detached-no-crash-expected.txt:
+
 2012-07-27  Brady Eidson  <[email protected]>
 
         Plugins should not be allowed to override standard properties/attributes in non-standard worlds

Modified: trunk/LayoutTests/gamepad/gamepad-api-expected.txt (123936 => 123937)


--- trunk/LayoutTests/gamepad/gamepad-api-expected.txt	2012-07-27 23:44:27 UTC (rev 123936)
+++ trunk/LayoutTests/gamepad/gamepad-api-expected.txt	2012-07-27 23:51:48 UTC (rev 123937)
@@ -1,4 +1,4 @@
-PASS navigator.webkitGamepads is defined.
+PASS navigator.webkitGetGamepads is defined.
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/gamepad/gamepad-api.html (123936 => 123937)


--- trunk/LayoutTests/gamepad/gamepad-api.html	2012-07-27 23:44:27 UTC (rev 123936)
+++ trunk/LayoutTests/gamepad/gamepad-api.html	2012-07-27 23:51:48 UTC (rev 123937)
@@ -2,7 +2,7 @@
 <body>
 <script src=""
 <script>
-    shouldBeDefined("navigator.webkitGamepads");
+    shouldBeDefined("navigator.webkitGetGamepads");
 </script>
 <script src=""
 <p>Make sure the main polling access point exists on navigator.</p>

Modified: trunk/LayoutTests/gamepad/gamepad-polling-access-expected.txt (123936 => 123937)


--- trunk/LayoutTests/gamepad/gamepad-polling-access-expected.txt	2012-07-27 23:44:27 UTC (rev 123936)
+++ trunk/LayoutTests/gamepad/gamepad-polling-access-expected.txt	2012-07-27 23:51:48 UTC (rev 123937)
@@ -1,18 +1,18 @@
-PASS navigator.webkitGamepads.length is 4
-PASS navigator.webkitGamepads[0] is undefined.
-PASS navigator.webkitGamepads[1] is undefined.
-PASS navigator.webkitGamepads[2] is undefined.
-PASS navigator.webkitGamepads[3] is undefined.
-PASS navigator.webkitGamepads[0] is non-null.
-PASS navigator.webkitGamepads[0] is undefined.
-PASS navigator.webkitGamepads[0].id is 'MockStick 3000'
-PASS navigator.webkitGamepads[0].buttons.length is 2
-PASS navigator.webkitGamepads[0].axes.length is 2
-PASS navigator.webkitGamepads[0].buttons[0] is 1.0
-PASS navigator.webkitGamepads[0].buttons[1] is 0.0
-PASS navigator.webkitGamepads[0].axes.length is 2
-PASS navigator.webkitGamepads[0].axes[0] is 0.5
-PASS navigator.webkitGamepads[0].axes[1] is -1.0
+PASS navigator.webkitGetGamepads().length is 4
+PASS navigator.webkitGetGamepads()[0] is undefined.
+PASS navigator.webkitGetGamepads()[1] is undefined.
+PASS navigator.webkitGetGamepads()[2] is undefined.
+PASS navigator.webkitGetGamepads()[3] is undefined.
+PASS navigator.webkitGetGamepads()[0] is non-null.
+PASS navigator.webkitGetGamepads()[0] is undefined.
+PASS navigator.webkitGetGamepads()[0].id is 'MockStick 3000'
+PASS navigator.webkitGetGamepads()[0].buttons.length is 2
+PASS navigator.webkitGetGamepads()[0].axes.length is 2
+PASS navigator.webkitGetGamepads()[0].buttons[0] is 1.0
+PASS navigator.webkitGetGamepads()[0].buttons[1] is 0.0
+PASS navigator.webkitGetGamepads()[0].axes.length is 2
+PASS navigator.webkitGetGamepads()[0].axes[0] is 0.5
+PASS navigator.webkitGetGamepads()[0].axes[1] is -1.0
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/gamepad/gamepad-polling-access.html (123936 => 123937)


--- trunk/LayoutTests/gamepad/gamepad-polling-access.html	2012-07-27 23:44:27 UTC (rev 123936)
+++ trunk/LayoutTests/gamepad/gamepad-polling-access.html	2012-07-27 23:51:48 UTC (rev 123937)
@@ -9,17 +9,17 @@
         gamepadController.disconnect(1);
         gamepadController.disconnect(2);
         gamepadController.disconnect(3);
-        shouldBe("navigator.webkitGamepads.length", "4");
-        shouldBeUndefined("navigator.webkitGamepads[0]");
-        shouldBeUndefined("navigator.webkitGamepads[1]");
-        shouldBeUndefined("navigator.webkitGamepads[2]");
-        shouldBeUndefined("navigator.webkitGamepads[3]");
+        shouldBe("navigator.webkitGetGamepads().length", "4");
+        shouldBeUndefined("navigator.webkitGetGamepads()[0]");
+        shouldBeUndefined("navigator.webkitGetGamepads()[1]");
+        shouldBeUndefined("navigator.webkitGetGamepads()[2]");
+        shouldBeUndefined("navigator.webkitGetGamepads()[3]");
 
         // connect and disconnect
         gamepadController.connect(0);
-        shouldBeNonNull("navigator.webkitGamepads[0]");
+        shouldBeNonNull("navigator.webkitGetGamepads()[0]");
         gamepadController.disconnect(0);
-        shouldBeUndefined("navigator.webkitGamepads[0]");
+        shouldBeUndefined("navigator.webkitGetGamepads()[0]");
 
         // connect again, and check standard access
         gamepadController.connect(0);
@@ -30,14 +30,14 @@
         gamepadController.setButtonData(0, 1, 0);
         gamepadController.setAxisData(0, 0, .5);
         gamepadController.setAxisData(0, 1, -1.0);
-        shouldBe("navigator.webkitGamepads[0].id", "'MockStick 3000'");
-        shouldBe("navigator.webkitGamepads[0].buttons.length", "2");
-        shouldBe("navigator.webkitGamepads[0].axes.length", "2");
-        shouldBe("navigator.webkitGamepads[0].buttons[0]", "1.0");
-        shouldBe("navigator.webkitGamepads[0].buttons[1]", "0.0");
-        shouldBe("navigator.webkitGamepads[0].axes.length", "2");
-        shouldBe("navigator.webkitGamepads[0].axes[0]", "0.5");
-        shouldBe("navigator.webkitGamepads[0].axes[1]", "-1.0");
+        shouldBe("navigator.webkitGetGamepads()[0].id", "'MockStick 3000'");
+        shouldBe("navigator.webkitGetGamepads()[0].buttons.length", "2");
+        shouldBe("navigator.webkitGetGamepads()[0].axes.length", "2");
+        shouldBe("navigator.webkitGetGamepads()[0].buttons[0]", "1.0");
+        shouldBe("navigator.webkitGetGamepads()[0].buttons[1]", "0.0");
+        shouldBe("navigator.webkitGetGamepads()[0].axes.length", "2");
+        shouldBe("navigator.webkitGetGamepads()[0].axes[0]", "0.5");
+        shouldBe("navigator.webkitGetGamepads()[0].axes[1]", "-1.0");
     }
     else
     {

Modified: trunk/LayoutTests/platform/chromium/fast/dom/navigator-detached-no-crash-expected.txt (123936 => 123937)


--- trunk/LayoutTests/platform/chromium/fast/dom/navigator-detached-no-crash-expected.txt	2012-07-27 23:44:27 UTC (rev 123936)
+++ trunk/LayoutTests/platform/chromium/fast/dom/navigator-detached-no-crash-expected.txt	2012-07-27 23:51:48 UTC (rev 123937)
@@ -17,7 +17,7 @@
 navigator.userAgent is OK
 navigator.vendor is OK
 navigator.vendorSub is OK
-navigator.webkitGamepads is OK
+navigator.webkitGetGamepads() is OK
 navigator.webkitPointer is OK
 navigator.webkitStartActivity() threw err TypeError: Not enough arguments
 navigator.appCodeName is OK
@@ -37,7 +37,7 @@
 navigator.userAgent is OK
 navigator.vendor is OK
 navigator.vendorSub is OK
-navigator.webkitGamepads is OK
+navigator.webkitGetGamepads() is OK
 navigator.webkitPointer is OK
 navigator.webkitStartActivity() threw err TypeError: Not enough arguments
 

Modified: trunk/Source/WebCore/ChangeLog (123936 => 123937)


--- trunk/Source/WebCore/ChangeLog	2012-07-27 23:44:27 UTC (rev 123936)
+++ trunk/Source/WebCore/ChangeLog	2012-07-27 23:51:48 UTC (rev 123937)
@@ -1,3 +1,25 @@
+2012-07-27  Scott Graham  <[email protected]>
+
+        Change navigator.webkitGamepads[] to navigator.webkitGetGamepads()
+        https://bugs.webkit.org/show_bug.cgi?id=92533
+
+        Reviewed by Adam Barth.
+
+        Per discussion on public-webapps. Pages that enumerate navigator were
+        causing background resources to be created to poll hardware
+        unintentionally. By changing to an explicit function call, this is
+        avoided (and the API becomes more clear too). This change updates the
+        implementation to match the current ED spec.
+
+        * Modules/gamepad/NavigatorGamepad.cpp:
+        (WebCore::NavigatorGamepad::webkitGetGamepads):
+        * Modules/gamepad/NavigatorGamepad.h:
+        (NavigatorGamepad):
+        * Modules/gamepad/NavigatorGamepad.idl:
+        * bindings/generic/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::setWebkitGetGamepadsEnabled):
+        (WebCore::RuntimeEnabledFeatures::webkitGetGamepadsEnabled):
+
 2012-07-27  Brady Eidson  <[email protected]>
 
         Plugins should not be allowed to override standard properties/attributes in non-standard worlds

Modified: trunk/Source/WebCore/Modules/gamepad/NavigatorGamepad.cpp (123936 => 123937)


--- trunk/Source/WebCore/Modules/gamepad/NavigatorGamepad.cpp	2012-07-27 23:44:27 UTC (rev 123936)
+++ trunk/Source/WebCore/Modules/gamepad/NavigatorGamepad.cpp	2012-07-27 23:51:48 UTC (rev 123937)
@@ -54,7 +54,7 @@
     return supplement;
 }
 
-GamepadList* NavigatorGamepad::webkitGamepads(Navigator* navigator)
+GamepadList* NavigatorGamepad::webkitGetGamepads(Navigator* navigator)
 {
     return NavigatorGamepad::from(navigator)->gamepads();
 }

Modified: trunk/Source/WebCore/Modules/gamepad/NavigatorGamepad.h (123936 => 123937)


--- trunk/Source/WebCore/Modules/gamepad/NavigatorGamepad.h	2012-07-27 23:44:27 UTC (rev 123936)
+++ trunk/Source/WebCore/Modules/gamepad/NavigatorGamepad.h	2012-07-27 23:51:48 UTC (rev 123937)
@@ -40,7 +40,7 @@
     virtual ~NavigatorGamepad();
     static NavigatorGamepad* from(Navigator*);
 
-    static GamepadList* webkitGamepads(Navigator*);
+    static GamepadList* webkitGetGamepads(Navigator*);
 
     GamepadList* gamepads();
 

Modified: trunk/Source/WebCore/Modules/gamepad/NavigatorGamepad.idl (123936 => 123937)


--- trunk/Source/WebCore/Modules/gamepad/NavigatorGamepad.idl	2012-07-27 23:44:27 UTC (rev 123936)
+++ trunk/Source/WebCore/Modules/gamepad/NavigatorGamepad.idl	2012-07-27 23:51:48 UTC (rev 123937)
@@ -23,7 +23,7 @@
         Conditional=GAMEPAD,
         Supplemental=Navigator
     ] NavigatorGamepad {
-        readonly attribute [V8EnabledAtRuntime] GamepadList webkitGamepads;
+        [V8EnabledAtRuntime] GamepadList webkitGetGamepads();
     };
 
 }

Modified: trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h (123936 => 123937)


--- trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h	2012-07-27 23:44:27 UTC (rev 123936)
+++ trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h	2012-07-27 23:51:48 UTC (rev 123937)
@@ -191,8 +191,8 @@
 #endif
 
 #if ENABLE(GAMEPAD)
-    static void setWebkitGamepadsEnabled(bool isEnabled) { isGamepadEnabled = isEnabled; }
-    static bool webkitGamepadsEnabled() { return isGamepadEnabled; }
+    static void setWebkitGetGamepadsEnabled(bool isEnabled) { isGamepadEnabled = isEnabled; }
+    static bool webkitGetGamepadsEnabled() { return isGamepadEnabled; }
 #endif
 
 #if ENABLE(QUOTA)

Modified: trunk/Source/WebKit/chromium/ChangeLog (123936 => 123937)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-07-27 23:44:27 UTC (rev 123936)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-07-27 23:51:48 UTC (rev 123937)
@@ -1,3 +1,16 @@
+2012-07-27  Scott Graham  <[email protected]>
+
+        Change navigator.webkitGamepads[] to navigator.webkitGetGamepads()
+        https://bugs.webkit.org/show_bug.cgi?id=92533
+
+        Reviewed by Adam Barth.
+
+        Renames for updated access point.
+
+        * src/WebRuntimeFeatures.cpp:
+        (WebKit::WebRuntimeFeatures::enableGamepad):
+        (WebKit::WebRuntimeFeatures::isGamepadEnabled):
+
 2012-07-27  Kevin Ellis  <[email protected]>
 
         [chromium] Calendar for input type=date should be larger on devices that support touch input.

Modified: trunk/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp (123936 => 123937)


--- trunk/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp	2012-07-27 23:44:27 UTC (rev 123936)
+++ trunk/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp	2012-07-27 23:51:48 UTC (rev 123937)
@@ -462,7 +462,7 @@
 void WebRuntimeFeatures::enableGamepad(bool enable)
 {
 #if ENABLE(GAMEPAD)
-    RuntimeEnabledFeatures::setWebkitGamepadsEnabled(enable);
+    RuntimeEnabledFeatures::setWebkitGetGamepadsEnabled(enable);
 #else
     UNUSED_PARAM(enable);
 #endif
@@ -471,7 +471,7 @@
 bool WebRuntimeFeatures::isGamepadEnabled()
 {
 #if ENABLE(GAMEPAD)
-    return RuntimeEnabledFeatures::webkitGamepadsEnabled();
+    return RuntimeEnabledFeatures::webkitGetGamepadsEnabled();
 #else
     return false;
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to