Title: [207038] trunk/Source/WebCore
- Revision
- 207038
- Author
- [email protected]
- Date
- 2016-10-10 19:55:26 -0700 (Mon, 10 Oct 2016)
Log Message
Update GamepadEvent to stop using legacy [ConstructorTemplate=Event]
https://bugs.webkit.org/show_bug.cgi?id=163243
Reviewed by Darin Adler.
Update GamepadEvent to stop using legacy [ConstructorTemplate=Event]
and use a proper constructor as in the specification:
- https://w3c.github.io/gamepad/#gamepadevent-interface
* Modules/gamepad/GamepadEvent.cpp:
(WebCore::GamepadEvent::GamepadEvent):
* Modules/gamepad/GamepadEvent.h:
(WebCore::GamepadEvent::create):
(WebCore::GamepadEvent::~GamepadEvent): Deleted.
* Modules/gamepad/GamepadEvent.idl:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (207037 => 207038)
--- trunk/Source/WebCore/ChangeLog 2016-10-11 02:21:58 UTC (rev 207037)
+++ trunk/Source/WebCore/ChangeLog 2016-10-11 02:55:26 UTC (rev 207038)
@@ -1,3 +1,21 @@
+2016-10-10 Chris Dumez <[email protected]>
+
+ Update GamepadEvent to stop using legacy [ConstructorTemplate=Event]
+ https://bugs.webkit.org/show_bug.cgi?id=163243
+
+ Reviewed by Darin Adler.
+
+ Update GamepadEvent to stop using legacy [ConstructorTemplate=Event]
+ and use a proper constructor as in the specification:
+ - https://w3c.github.io/gamepad/#gamepadevent-interface
+
+ * Modules/gamepad/GamepadEvent.cpp:
+ (WebCore::GamepadEvent::GamepadEvent):
+ * Modules/gamepad/GamepadEvent.h:
+ (WebCore::GamepadEvent::create):
+ (WebCore::GamepadEvent::~GamepadEvent): Deleted.
+ * Modules/gamepad/GamepadEvent.idl:
+
2016-10-10 Darin Adler <[email protected]>
Move Fetch from legacy to new DOM exceptions
Modified: trunk/Source/WebCore/Modules/gamepad/GamepadEvent.cpp (207037 => 207038)
--- trunk/Source/WebCore/Modules/gamepad/GamepadEvent.cpp 2016-10-11 02:21:58 UTC (rev 207037)
+++ trunk/Source/WebCore/Modules/gamepad/GamepadEvent.cpp 2016-10-11 02:55:26 UTC (rev 207038)
@@ -35,8 +35,8 @@
{
}
-GamepadEvent::GamepadEvent(const AtomicString& eventType, const GamepadEventInit& initializer)
- : Event(eventType, initializer)
+GamepadEvent::GamepadEvent(const AtomicString& eventType, const Init& initializer, IsTrusted isTrusted)
+ : Event(eventType, initializer, isTrusted)
, m_gamepad(initializer.gamepad)
{
}
Modified: trunk/Source/WebCore/Modules/gamepad/GamepadEvent.h (207037 => 207038)
--- trunk/Source/WebCore/Modules/gamepad/GamepadEvent.h 2016-10-11 02:21:58 UTC (rev 207037)
+++ trunk/Source/WebCore/Modules/gamepad/GamepadEvent.h 2016-10-11 02:55:26 UTC (rev 207038)
@@ -33,10 +33,6 @@
namespace WebCore {
-struct GamepadEventInit : public EventInit {
- RefPtr<Gamepad> gamepad;
-};
-
class GamepadEvent : public Event {
public:
~GamepadEvent() { }
@@ -46,9 +42,13 @@
return adoptRef(*new GamepadEvent(eventType, gamepad));
}
- static Ref<GamepadEvent> createForBindings(const AtomicString& eventType, const GamepadEventInit& initializer)
+ struct Init : EventInit {
+ RefPtr<Gamepad> gamepad;
+ };
+
+ static Ref<GamepadEvent> create(const AtomicString& eventType, const Init& initializer, IsTrusted isTrusted = IsTrusted::No)
{
- return adoptRef(*new GamepadEvent(eventType, initializer));
+ return adoptRef(*new GamepadEvent(eventType, initializer, isTrusted));
}
Gamepad* gamepad() const { return m_gamepad.get(); }
@@ -57,7 +57,7 @@
private:
explicit GamepadEvent(const AtomicString& eventType, Gamepad&);
- GamepadEvent(const AtomicString& eventType, const GamepadEventInit&);
+ GamepadEvent(const AtomicString& eventType, const Init&, IsTrusted);
RefPtr<Gamepad> m_gamepad;
};
Modified: trunk/Source/WebCore/Modules/gamepad/GamepadEvent.idl (207037 => 207038)
--- trunk/Source/WebCore/Modules/gamepad/GamepadEvent.idl 2016-10-11 02:21:58 UTC (rev 207037)
+++ trunk/Source/WebCore/Modules/gamepad/GamepadEvent.idl 2016-10-11 02:55:26 UTC (rev 207038)
@@ -24,10 +24,15 @@
*/
[
+ Conditional=GAMEPAD,
+ Constructor(DOMString type, GamepadEventInit eventInitDict),
EnabledAtRuntime=Gamepads,
- Conditional=GAMEPAD,
- ConstructorTemplate=Event
] interface GamepadEvent : Event {
- [InitializedByEventConstructor] readonly attribute Gamepad gamepad;
+ readonly attribute Gamepad? gamepad;
};
+dictionary GamepadEventInit : EventInit {
+ // The specification says this member should be required and non-nullable.
+ // However, this does not match the behavior of Chrome or Firefox.
+ Gamepad? gamepad = null;
+};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes