Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(910)

Issue 808643005: Sync Navigator.getGamepads() with the spec

Created:
6 years ago by philipj_slow
Modified:
5 years, 10 months ago
Reviewers:
kbalazs, bajones
CC:
blink-reviews
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Sync Navigator.getGamepads() with the spec https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension https://www.w3.org/Bugs/Public/show_bug.cgi?id=26181 The spec allows the returned array to be longer than necessary. The minimum possible length is used instead, and a spec bug was filed: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27986 BUG=344556

Patch Set 1 #

Total comments: 8

Patch Set 2 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+88 lines, -96 lines) Patch
M LayoutTests/gamepad/gamepad-api.html View 1 1 chunk +5 lines, -4 lines 0 comments Download
M LayoutTests/gamepad/gamepad-api-expected.txt View 1 1 chunk +3 lines, -4 lines 0 comments Download
M LayoutTests/gamepad/gamepad-polling-access.html View 1 1 chunk +28 lines, -12 lines 0 comments Download
M LayoutTests/gamepad/gamepad-polling-access-expected.txt View 1 1 chunk +25 lines, -12 lines 0 comments Download
M Source/modules/gamepad/GamepadList.h View 1 chunk +1 line, -3 lines 0 comments Download
D Source/modules/gamepad/GamepadList.idl View 1 chunk +0 lines, -32 lines 0 comments Download
M Source/modules/gamepad/NavigatorGamepad.h View 1 3 chunks +3 lines, -4 lines 0 comments Download
M Source/modules/gamepad/NavigatorGamepad.cpp View 1 3 chunks +20 lines, -23 lines 0 comments Download
M Source/modules/gamepad/NavigatorGamepad.idl View 1 1 chunk +3 lines, -1 line 0 comments Download
M Source/modules/modules.gypi View 1 1 chunk +0 lines, -1 line 0 comments Download

Messages

Total messages: 13 (1 generated)
philipj_slow
PTAL. As the FIXMEs in gamepad-polling-access.html suggest, this still doesn't do what the spec does. ...
6 years ago (2014-12-17 21:29:39 UTC) #2
kbalazs
Looks good modulo nuances. Exposing an array as an array sound good :) https://codereview.chromium.org/808643005/diff/1/Source/modules/gamepad/NavigatorGamepad.cpp File ...
6 years ago (2014-12-17 21:53:41 UTC) #3
kbalazs
On 2014/12/17 21:53:41, kbalazs wrote: > Looks good modulo nuances. > > Exposing an array ...
6 years ago (2014-12-17 21:56:33 UTC) #4
philipj_slow
So, about holes in the array. The simplest thing is to just return the existing ...
6 years ago (2014-12-17 22:45:38 UTC) #5
philipj_slow
Oh, there's already a spec bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26181 Let's try to move that along, then.
6 years ago (2014-12-17 22:55:57 UTC) #6
philipj_slow
Oh, there's already a spec bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=26181 Let's try to move that along, then.
6 years ago (2014-12-17 22:55:58 UTC) #7
kbalazs
https://codereview.chromium.org/808643005/diff/1/Source/modules/gamepad/NavigatorGamepad.cpp File Source/modules/gamepad/NavigatorGamepad.cpp (right): https://codereview.chromium.org/808643005/diff/1/Source/modules/gamepad/NavigatorGamepad.cpp#newcode107 Source/modules/gamepad/NavigatorGamepad.cpp:107: gamepads[i] = gamepad; I see this in Vector::shrink: TypeOperations::destruct(begin() ...
6 years ago (2014-12-18 00:34:39 UTC) #8
philipj_slow
Clearly this code is non-obvious, I think it would be clearer without the intermediate GamepadList. ...
6 years ago (2014-12-18 08:29:03 UTC) #9
bajones
On 2014/12/18 at 08:29:03, philipj wrote: > Clearly this code is non-obvious, I think it ...
6 years ago (2014-12-18 17:37:47 UTC) #10
philipj_slow
rebase
5 years, 10 months ago (2015-02-07 04:50:38 UTC) #11
philipj_slow
Please ignore the rebase, this still isn't ready for review. Time allowing I'll tend to ...
5 years, 10 months ago (2015-02-07 04:53:06 UTC) #12
philipj_slow
5 years, 10 months ago (2015-02-09 13:53:26 UTC) #13
Hi guys,

I started working on a refresh of this CL today in order to implement the change
from https://www.w3.org/Bugs/Public/show_bug.cgi?id=26181

However, it quickly became clear that there are further problem in the spec:
https://www.w3.org/Bugs/Public/show_bug.cgi?id=21434#c6

I see two choices:

1. Create a new Gamepad object whenever needed, including for the GamepadEvent.
This seems a bit crazy to me.

2. Ensure that scripts see a single Gamepad object for its entire lifetime. This
necessarily means that these objects will be live, however, and that scripts
don't need to call navigator.getGamepad() to get new state, they could just keep
a reference to the gamepad they got in the gamepadconnected event.

Neither seems particularly appealing to me, honestly. This CL is just a guest
appearance in the gamepad module on my part, so I would appreciate your feedback
on this.

There's also a related problem: It looks like Gamepad.axes and Gamepad.buttons
will return a new array every time, such that gamepad.axes!=gamepad.axes. I
don't have an actual gamepad for testing, could you confirm if this is the case
and intentional?

Powered by Google App Engine
This is Rietveld 408576698