Changeset 101065 in webkit


Ignore:
Timestamp:
Nov 23, 2011 4:16:13 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Adding gamepad support
https://bugs.webkit.org/show_bug.cgi?id=69451

Source/WebCore:

Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23
Reviewed by Darin Fisher.

Plumb gamepad data access through platform.

Test: gamepad/gamepad-polling-access.html

  • WebCore.gypi:
  • page/Navigator.cpp:

(WebCore::Navigator::webkitGamepads):

  • page/Navigator.h:
  • platform/Gamepads.h: Added.
  • platform/chromium/GamepadsChromium.cpp: Added.

(WebCore::sampleGamepads):

  • platform/chromium/PlatformSupport.h:

Source/WebKit/chromium:

Add implementation of sampleGamepads in Chromium platform. Retrieves
gamepad data from Chromium port and converts to DOM format, i.e.
GamepadList.

Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23
Reviewed by Darin Fisher.

  • src/PlatformSupport.cpp:

(WebCore::PlatformSupport::sampleGamepads):

Tools:

Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23
Reviewed by Darin Fisher.

Add a 'gamepadController' to Chromium DRT. Allows for setting of mock
gamepad data that will be retrieved when JS code pulls via API access.

  • DumpRenderTree/DumpRenderTree.gypi:
  • DumpRenderTree/chromium/GamepadController.cpp: Added.

(GamepadController::GamepadController):
(GamepadController::bindToJavascript):
(GamepadController::reset):
(GamepadController::connect):
(GamepadController::disconnect):
(GamepadController::setId):
(GamepadController::setButtonCount):
(GamepadController::setButtonData):
(GamepadController::setAxisCount):
(GamepadController::setAxisData):
(GamepadController::fallbackCallback):

  • DumpRenderTree/chromium/GamepadController.h: Added.
  • DumpRenderTree/chromium/TestShell.cpp:

(TestShell::TestShell):
(TestShell::resetTestController):
(TestShell::bindJSObjectsToWindow):

  • DumpRenderTree/chromium/TestShell.h:

(TestShell::gamepadController):

LayoutTests:

Patch by Scott Graham <scottmg@chromium.org> on 2011-11-23
Reviewed by Darin Fisher.

  • fast/dom/script-tests/prototype-inheritance.js: Exclude

gamepadController from enumeration.

  • gamepad/gamepad-polling-access-expected.txt: Added.
  • gamepad/gamepad-polling-access.html: Added.
Location:
trunk
Files:
6 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r101063 r101065  
     12011-11-23  Scott Graham  <scottmg@chromium.org>
     2
     3        Adding gamepad support
     4        https://bugs.webkit.org/show_bug.cgi?id=69451
     5
     6        Reviewed by Darin Fisher.
     7
     8        * fast/dom/script-tests/prototype-inheritance.js: Exclude
     9        gamepadController from enumeration.
     10        * gamepad/gamepad-polling-access-expected.txt: Added.
     11        * gamepad/gamepad-polling-access.html: Added.
     12
    1132011-11-23  Nikolas Zimmermann  <nzimmermann@rim.com>
    214
  • trunk/LayoutTests/fast/dom/script-tests/prototype-inheritance.js

    r98407 r101065  
    1313    "eventSender", "objCPlugin", "objCPluginFunction",
    1414    "appleScriptController", "plainText", "accessibilityController",
     15    "gamepadController",
    1516    "internals",
    1617    // Ignore these properties because they do not exist in all implementations. They will be tested separately
  • trunk/Source/WebCore/ChangeLog

    r101064 r101065  
     12011-11-23  Scott Graham  <scottmg@chromium.org>
     2
     3        Adding gamepad support
     4        https://bugs.webkit.org/show_bug.cgi?id=69451
     5
     6        Reviewed by Darin Fisher.
     7
     8        Plumb gamepad data access through platform.
     9
     10        Test: gamepad/gamepad-polling-access.html
     11
     12        * WebCore.gypi:
     13        * page/Navigator.cpp:
     14        (WebCore::Navigator::webkitGamepads):
     15        * page/Navigator.h:
     16        * platform/Gamepads.h: Added.
     17        * platform/chromium/GamepadsChromium.cpp: Added.
     18        (WebCore::sampleGamepads):
     19        * platform/chromium/PlatformSupport.h:
     20
    1212011-11-23  Dmitry Lomov  <dslomov@google.com>
    222
  • trunk/Source/WebCore/WebCore.gypi

    r101012 r101065  
    32413241            'platform/chromium/FramelessScrollView.h',
    32423242            'platform/chromium/FramelessScrollViewClient.h',
     3243            'platform/chromium/GamepadsChromium.cpp',
    32433244            'platform/chromium/GestureRecognizerChromium.cpp',
    32443245            'platform/chromium/GestureRecognizerChromium.h',
  • trunk/Source/WebCore/page/Navigator.cpp

    r100860 r101065  
    4848#if ENABLE(GAMEPAD)
    4949#include "GamepadList.h"
     50#include "Gamepads.h"
    5051#endif
    5152
     
    312313GamepadList* Navigator::webkitGamepads()
    313314{
    314     // Stubbed until platform/ changes landed.
    315     return 0;
     315    if (!m_gamepads)
     316        m_gamepads = GamepadList::create();
     317    sampleGamepads(m_gamepads.get());
     318    return m_gamepads.get();
    316319}
    317320#endif
  • trunk/Source/WebCore/page/Navigator.h

    r100833 r101065  
    8686    mutable RefPtr<DOMMimeTypeArray> m_mimeTypes;
    8787    mutable RefPtr<Geolocation> m_geolocation;
     88#if ENABLE(GAMEPAD)
     89    mutable RefPtr<GamepadList> m_gamepads;
     90#endif
    8891#if ENABLE(POINTER_LOCK)
    8992    mutable RefPtr<PointerLock> m_pointer;
  • trunk/Source/WebCore/platform/chromium/PlatformSupport.h

    r101031 r101065  
    7272class Document;
    7373class Frame;
     74class GamepadList;
    7475class GeolocationServiceBridge;
    7576class GeolocationServiceChromium;
     
    182183    // Injects key via keyPath into value. Returns true on success.
    183184    static PassRefPtr<SerializedScriptValue> injectIDBKeyIntoSerializedValue(PassRefPtr<IDBKey>, PassRefPtr<SerializedScriptValue>, const String& keyPath);
     185
     186    // Gamepad -----------------------------------------------------------
     187    static void sampleGamepads(GamepadList* into);
    184188
    185189    // JavaScript ---------------------------------------------------------
  • trunk/Source/WebKit/chromium/ChangeLog

    r101064 r101065  
     12011-11-23  Scott Graham  <scottmg@chromium.org>
     2
     3        Adding gamepad support
     4        https://bugs.webkit.org/show_bug.cgi?id=69451
     5
     6        Add implementation of sampleGamepads in Chromium platform. Retrieves
     7        gamepad data from Chromium port and converts to DOM format, i.e.
     8        GamepadList.
     9
     10        Reviewed by Darin Fisher.
     11
     12        * src/PlatformSupport.cpp:
     13        (WebCore::PlatformSupport::sampleGamepads):
     14
    1152011-11-23  Dmitry Lomov  <dslomov@google.com>
    216
  • trunk/Source/WebKit/chromium/src/PlatformSupport.cpp

    r101031 r101065  
    9191#include "Document.h"
    9292#include "FrameView.h"
     93#include "GamepadList.h"
    9394#include "GraphicsContext.h"
    9495#include "IDBFactoryBackendProxy.h"
     
    525526{
    526527    return webKitPlatformSupport()->injectIDBKeyIntoSerializedValue(key, value, keyPath);
     528}
     529
     530// Gamepad --------------------------------------------------------------------
     531
     532void PlatformSupport::sampleGamepads(GamepadList* into)
     533{
     534    WebGamepads gamepads;
     535
     536    webKitPlatformSupport()->sampleGamepads(gamepads);
     537
     538    for (unsigned i = 0; i < WebKit::WebGamepads::itemsLengthCap; ++i) {
     539        WebGamepad& webGamepad = gamepads.items[i];
     540        if (i < gamepads.length && webGamepad.connected) {
     541            RefPtr<Gamepad> gamepad = into->item(i);
     542            if (!gamepad)
     543                gamepad = Gamepad::create();
     544            gamepad->id(webGamepad.id);
     545            gamepad->index(i);
     546            gamepad->timestamp(webGamepad.timestamp);
     547            gamepad->axes(webGamepad.axesLength, webGamepad.axes);
     548            gamepad->buttons(webGamepad.buttonsLength, webGamepad.buttons);
     549            into->set(i, gamepad);
     550        } else
     551            into->set(i, 0);
     552    }
    527553}
    528554
  • trunk/Tools/ChangeLog

    r101052 r101065  
     12011-11-23  Scott Graham  <scottmg@chromium.org>
     2
     3        Adding gamepad support
     4        https://bugs.webkit.org/show_bug.cgi?id=69451
     5
     6        Reviewed by Darin Fisher.
     7
     8        Add a 'gamepadController' to Chromium DRT. Allows for setting of mock
     9        gamepad data that will be retrieved when JS code pulls via API access.
     10
     11        * DumpRenderTree/DumpRenderTree.gypi:
     12        * DumpRenderTree/chromium/GamepadController.cpp: Added.
     13        (GamepadController::GamepadController):
     14        (GamepadController::bindToJavascript):
     15        (GamepadController::reset):
     16        (GamepadController::connect):
     17        (GamepadController::disconnect):
     18        (GamepadController::setId):
     19        (GamepadController::setButtonCount):
     20        (GamepadController::setButtonData):
     21        (GamepadController::setAxisCount):
     22        (GamepadController::setAxisData):
     23        (GamepadController::fallbackCallback):
     24        * DumpRenderTree/chromium/GamepadController.h: Added.
     25        * DumpRenderTree/chromium/TestShell.cpp:
     26        (TestShell::TestShell):
     27        (TestShell::resetTestController):
     28        (TestShell::bindJSObjectsToWindow):
     29        * DumpRenderTree/chromium/TestShell.h:
     30        (TestShell::gamepadController):
     31
    1322011-11-23  Raphael Kubo da Costa  <kubo@profusion.mobi>
    233
  • trunk/Tools/DumpRenderTree/DumpRenderTree.gypi

    r97678 r101065  
    1717            'chromium/EventSender.cpp',
    1818            'chromium/EventSender.h',
     19            'chromium/GamepadController.cpp',
     20            'chromium/GamepadController.h',
    1921            'chromium/LayoutTestController.cpp',
    2022            'chromium/LayoutTestController.h',
  • trunk/Tools/DumpRenderTree/chromium/TestShell.cpp

    r101025 r101065  
    128128    m_webPermissions = adoptPtr(new WebPermissions(this));
    129129    m_accessibilityController = adoptPtr(new AccessibilityController(this));
     130    m_gamepadController = adoptPtr(new GamepadController(this));
    130131    m_layoutTestController = adoptPtr(new LayoutTestController(this));
    131132    m_eventSender = adoptPtr(new EventSender(this));
     
    271272    m_webPermissions->reset();
    272273    m_accessibilityController->reset();
     274    m_gamepadController->reset();
    273275    m_layoutTestController->reset();
    274276    m_eventSender->reset();
     
    674676    WebTestingSupport::injectInternalsObject(frame);
    675677    m_accessibilityController->bindToJavascript(frame, WebString::fromUTF8("accessibilityController"));
     678    m_gamepadController->bindToJavascript(frame, WebString::fromUTF8("gamepadController"));
    676679    m_layoutTestController->bindToJavascript(frame, WebString::fromUTF8("layoutTestController"));
    677680    m_eventSender->bindToJavascript(frame, WebString::fromUTF8("eventSender"));
  • trunk/Tools/DumpRenderTree/chromium/TestShell.h

    r100355 r101065  
    3434#include "AccessibilityController.h"
    3535#include "EventSender.h"
     36#include "GamepadController.h"
    3637#include "LayoutTestController.h"
    3738#include "NotificationPresenter.h"
     
    9293    EventSender* eventSender() const { return m_eventSender.get(); }
    9394    AccessibilityController* accessibilityController() const { return m_accessibilityController.get(); }
     95    GamepadController* gamepadController() const { return m_gamepadController.get(); }
    9496    NotificationPresenter* notificationPresenter() const { return m_notificationPresenter.get(); }
    9597    TestEventPrinter* printer() const { return m_printer.get(); }
     
    206208    OwnPtr<DRTDevToolsClient> m_drtDevToolsClient;
    207209    OwnPtr<AccessibilityController> m_accessibilityController;
     210    OwnPtr<GamepadController> m_gamepadController;
    208211    OwnPtr<EventSender> m_eventSender;
    209212    OwnPtr<LayoutTestController> m_layoutTestController;
Note: See TracChangeset for help on using the changeset viewer.