Diff
Modified: trunk/LayoutTests/ChangeLog (206970 => 206971)
--- trunk/LayoutTests/ChangeLog 2016-10-09 22:47:57 UTC (rev 206970)
+++ trunk/LayoutTests/ChangeLog 2016-10-09 23:11:56 UTC (rev 206971)
@@ -1,3 +1,17 @@
+2016-10-09 Chris Dumez <[email protected]>
+
+ Update KeyboardEvent to stop using legacy [ConstructorTemplate=Event]
+ https://bugs.webkit.org/show_bug.cgi?id=163176
+
+ Reviewed by Darin Adler.
+
+ Rebaseline existing test now that the exception message is slightly
+ different in some cases. Also add test coverage for passing
+ modifierAltGraph / modifierCapsLock in initialization dictionary.
+
+ * fast/events/constructors/keyboard-event-constructor-expected.txt:
+ * fast/events/constructors/keyboard-event-constructor.html:
+
2016-10-09 Michael Catanzaro <[email protected]>
[GTK] Miscellaneous unreviewed test gardening
Modified: trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor-expected.txt (206970 => 206971)
--- trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor-expected.txt 2016-10-09 22:47:57 UTC (rev 206970)
+++ trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor-expected.txt 2016-10-09 23:11:56 UTC (rev 206971)
@@ -25,23 +25,23 @@
PASS new KeyboardEvent('eventType', { }).isComposing is false
PASS new KeyboardEvent('eventType', { isComposing: false }).isComposing is false
PASS new KeyboardEvent('eventType', { isComposing: true }).isComposing is true
-PASS new KeyboardEvent('eventType', { view: testObject }).view threw exception TypeError: Dictionary member is not of type Window.
-PASS new KeyboardEvent('eventType', { view: document }).view threw exception TypeError: Dictionary member is not of type Window.
+PASS new KeyboardEvent('eventType', { view: testObject }).view threw exception TypeError: Type error.
+PASS new KeyboardEvent('eventType', { view: document }).view threw exception TypeError: Type error.
PASS new KeyboardEvent('eventType', { view: undefined }).view is null
PASS new KeyboardEvent('eventType', { view: null }).view is null
-PASS new KeyboardEvent('eventType', { view: false }).view threw exception TypeError: Dictionary member is not of type Window.
-PASS new KeyboardEvent('eventType', { view: true }).view threw exception TypeError: Dictionary member is not of type Window.
-PASS new KeyboardEvent('eventType', { view: '' }).view threw exception TypeError: Dictionary member is not of type Window.
-PASS new KeyboardEvent('eventType', { view: 'chocolate' }).view threw exception TypeError: Dictionary member is not of type Window.
-PASS new KeyboardEvent('eventType', { view: 12345 }).view threw exception TypeError: Dictionary member is not of type Window.
-PASS new KeyboardEvent('eventType', { view: 18446744073709551615 }).view threw exception TypeError: Dictionary member is not of type Window.
-PASS new KeyboardEvent('eventType', { view: NaN }).view threw exception TypeError: Dictionary member is not of type Window.
-PASS new KeyboardEvent('eventType', { view: {valueOf: function () { return window; } } }).view threw exception TypeError: Dictionary member is not of type Window.
-PASS new KeyboardEvent('eventType', { get view() { return 123; } }).view threw exception TypeError: Dictionary member is not of type Window.
+PASS new KeyboardEvent('eventType', { view: false }).view threw exception TypeError: Type error.
+PASS new KeyboardEvent('eventType', { view: true }).view threw exception TypeError: Type error.
+PASS new KeyboardEvent('eventType', { view: '' }).view threw exception TypeError: Type error.
+PASS new KeyboardEvent('eventType', { view: 'chocolate' }).view threw exception TypeError: Type error.
+PASS new KeyboardEvent('eventType', { view: 12345 }).view threw exception TypeError: Type error.
+PASS new KeyboardEvent('eventType', { view: 18446744073709551615 }).view threw exception TypeError: Type error.
+PASS new KeyboardEvent('eventType', { view: NaN }).view threw exception TypeError: Type error.
+PASS new KeyboardEvent('eventType', { view: {valueOf: function () { return window; } } }).view threw exception TypeError: Type error.
+PASS new KeyboardEvent('eventType', { get view() { return 123; } }).view threw exception TypeError: Type error.
PASS new KeyboardEvent('eventType', { get view() { throw 'KeyboardEvent Error'; } }) threw exception KeyboardEvent Error.
PASS new KeyboardEvent('eventType', { keyIdentifier: 'koakuma' }).keyIdentifier is "koakuma"
PASS new KeyboardEvent('eventType', { keyIdentifier: '' }).keyIdentifier is ""
-PASS new KeyboardEvent('eventType', { keyIdentifier: undefined }).keyIdentifier is "undefined"
+PASS new KeyboardEvent('eventType', { keyIdentifier: undefined }).keyIdentifier is ""
PASS new KeyboardEvent('eventType', { keyIdentifier: null }).keyIdentifier is "null"
PASS new KeyboardEvent('eventType', { keyIdentifier: false }).keyIdentifier is "false"
PASS new KeyboardEvent('eventType', { keyIdentifier: true }).keyIdentifier is "true"
@@ -106,6 +106,8 @@
PASS new KeyboardEvent('eventType', { shiftKey: true }).shiftKey is true
PASS new KeyboardEvent('eventType', { metaKey: false }).metaKey is false
PASS new KeyboardEvent('eventType', { metaKey: true }).metaKey is true
+PASS new KeyboardEvent('eventType', { modifierAltGraph: true }).getModifierState('AltGraph') is true
+PASS new KeyboardEvent('eventType', { modifierCapsLock: true }).getModifierState('CapsLock') is true
PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).bubbles is true
PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).cancelable is true
PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).view is window
Modified: trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor.html (206970 => 206971)
--- trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor.html 2016-10-09 22:47:57 UTC (rev 206970)
+++ trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor.html 2016-10-09 23:11:56 UTC (rev 206971)
@@ -68,7 +68,7 @@
shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: '' }).keyIdentifier", "");
// Non-strings.
-shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: undefined }).keyIdentifier", "undefined");
+shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: undefined }).keyIdentifier", "");
shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: null }).keyIdentifier", "null");
shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: false }).keyIdentifier", "false");
shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: true }).keyIdentifier", "true");
@@ -121,6 +121,9 @@
shouldBe("new KeyboardEvent('eventType', { " + attr + ": true })." + attr, "true");
});
+shouldBeTrue("new KeyboardEvent('eventType', { modifierAltGraph: true }).getModifierState('AltGraph')");
+shouldBeTrue("new KeyboardEvent('eventType', { modifierCapsLock: true }).getModifierState('CapsLock')");
+
// All initializers are passed.
shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).bubbles", "true");
shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).cancelable", "true");
Modified: trunk/LayoutTests/platform/ios-simulator/fast/events/constructors/keyboard-event-constructor-expected.txt (206970 => 206971)
--- trunk/LayoutTests/platform/ios-simulator/fast/events/constructors/keyboard-event-constructor-expected.txt 2016-10-09 22:47:57 UTC (rev 206970)
+++ trunk/LayoutTests/platform/ios-simulator/fast/events/constructors/keyboard-event-constructor-expected.txt 2016-10-09 23:11:56 UTC (rev 206971)
@@ -25,23 +25,23 @@
PASS new KeyboardEvent('eventType', { }).isComposing is false
PASS new KeyboardEvent('eventType', { isComposing: false }).isComposing is false
PASS new KeyboardEvent('eventType', { isComposing: true }).isComposing is true
-PASS new KeyboardEvent('eventType', { view: testObject }).view threw exception TypeError: Dictionary member is not of type Window.
-PASS new KeyboardEvent('eventType', { view: document }).view threw exception TypeError: Dictionary member is not of type Window.
+PASS new KeyboardEvent('eventType', { view: testObject }).view threw exception TypeError: Type error.
+PASS new KeyboardEvent('eventType', { view: document }).view threw exception TypeError: Type error.
PASS new KeyboardEvent('eventType', { view: undefined }).view is null
PASS new KeyboardEvent('eventType', { view: null }).view is null
-PASS new KeyboardEvent('eventType', { view: false }).view threw exception TypeError: Dictionary member is not of type Window.
-PASS new KeyboardEvent('eventType', { view: true }).view threw exception TypeError: Dictionary member is not of type Window.
-PASS new KeyboardEvent('eventType', { view: '' }).view threw exception TypeError: Dictionary member is not of type Window.
-PASS new KeyboardEvent('eventType', { view: 'chocolate' }).view threw exception TypeError: Dictionary member is not of type Window.
-PASS new KeyboardEvent('eventType', { view: 12345 }).view threw exception TypeError: Dictionary member is not of type Window.
-PASS new KeyboardEvent('eventType', { view: 18446744073709551615 }).view threw exception TypeError: Dictionary member is not of type Window.
-PASS new KeyboardEvent('eventType', { view: NaN }).view threw exception TypeError: Dictionary member is not of type Window.
-PASS new KeyboardEvent('eventType', { view: {valueOf: function () { return window; } } }).view threw exception TypeError: Dictionary member is not of type Window.
-PASS new KeyboardEvent('eventType', { get view() { return 123; } }).view threw exception TypeError: Dictionary member is not of type Window.
+PASS new KeyboardEvent('eventType', { view: false }).view threw exception TypeError: Type error.
+PASS new KeyboardEvent('eventType', { view: true }).view threw exception TypeError: Type error.
+PASS new KeyboardEvent('eventType', { view: '' }).view threw exception TypeError: Type error.
+PASS new KeyboardEvent('eventType', { view: 'chocolate' }).view threw exception TypeError: Type error.
+PASS new KeyboardEvent('eventType', { view: 12345 }).view threw exception TypeError: Type error.
+PASS new KeyboardEvent('eventType', { view: 18446744073709551615 }).view threw exception TypeError: Type error.
+PASS new KeyboardEvent('eventType', { view: NaN }).view threw exception TypeError: Type error.
+PASS new KeyboardEvent('eventType', { view: {valueOf: function () { return window; } } }).view threw exception TypeError: Type error.
+PASS new KeyboardEvent('eventType', { get view() { return 123; } }).view threw exception TypeError: Type error.
PASS new KeyboardEvent('eventType', { get view() { throw 'KeyboardEvent Error'; } }) threw exception KeyboardEvent Error.
PASS new KeyboardEvent('eventType', { keyIdentifier: 'koakuma' }).keyIdentifier is "koakuma"
PASS new KeyboardEvent('eventType', { keyIdentifier: '' }).keyIdentifier is ""
-PASS new KeyboardEvent('eventType', { keyIdentifier: undefined }).keyIdentifier is "undefined"
+PASS new KeyboardEvent('eventType', { keyIdentifier: undefined }).keyIdentifier is ""
PASS new KeyboardEvent('eventType', { keyIdentifier: null }).keyIdentifier is "null"
PASS new KeyboardEvent('eventType', { keyIdentifier: false }).keyIdentifier is "false"
PASS new KeyboardEvent('eventType', { keyIdentifier: true }).keyIdentifier is "true"
@@ -106,6 +106,8 @@
PASS new KeyboardEvent('eventType', { shiftKey: true }).shiftKey is true
PASS new KeyboardEvent('eventType', { metaKey: false }).metaKey is false
PASS new KeyboardEvent('eventType', { metaKey: true }).metaKey is true
+PASS new KeyboardEvent('eventType', { modifierAltGraph: true }).getModifierState('AltGraph') is true
+PASS new KeyboardEvent('eventType', { modifierCapsLock: true }).getModifierState('CapsLock') is true
PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).bubbles is true
PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).cancelable is true
PASS new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, key: 'a', code: 'KeyA', keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).view is window
Modified: trunk/Source/WebCore/CMakeLists.txt (206970 => 206971)
--- trunk/Source/WebCore/CMakeLists.txt 2016-10-09 22:47:57 UTC (rev 206970)
+++ trunk/Source/WebCore/CMakeLists.txt 2016-10-09 23:11:56 UTC (rev 206971)
@@ -399,6 +399,7 @@
dom/ErrorEvent.idl
dom/Event.idl
dom/EventInit.idl
+ dom/EventModifierInit.idl
dom/EventTarget.idl
dom/FocusEvent.idl
dom/GlobalEventHandlers.idl
@@ -439,6 +440,7 @@
dom/TransitionEvent.idl
dom/TreeWalker.idl
dom/UIEvent.idl
+ dom/UIEventInit.idl
dom/WebKitAnimationEvent.idl
dom/WebKitNamedFlow.idl
dom/WebKitTransitionEvent.idl
Modified: trunk/Source/WebCore/ChangeLog (206970 => 206971)
--- trunk/Source/WebCore/ChangeLog 2016-10-09 22:47:57 UTC (rev 206970)
+++ trunk/Source/WebCore/ChangeLog 2016-10-09 23:11:56 UTC (rev 206971)
@@ -1,3 +1,51 @@
+2016-10-09 Chris Dumez <[email protected]>
+
+ Update KeyboardEvent to stop using legacy [ConstructorTemplate=Event]
+ https://bugs.webkit.org/show_bug.cgi?id=163176
+
+ Reviewed by Darin Adler.
+
+ Update KeyboardEvent to stop using legacy [ConstructorTemplate=Event]
+ and use a proper constructor instead, like in the specification:
+ - https://www.w3.org/TR/uievents/#interface-keyboardevent
+
+ Also add support for passing modifierAltGraph / modifierCapsLock
+ in the inialization dictionary as we support those modifiers via
+ getModifierState().
+
+ No new tests, extended existing test.
+
+ * CMakeLists.txt:
+ * DerivedSources.cpp:
+ * DerivedSources.make:
+ * WebCore.xcodeproj/project.pbxproj:
+ * dom/EventModifierInit.h: Added.
+ (WebCore::EventModifierInit::EventModifierInit):
+ * dom/EventModifierInit.idl: Added.
+ * dom/KeyboardEvent.cpp:
+ (WebCore::KeyboardEvent::KeyboardEvent):
+ (WebCore::KeyboardEvent::getModifierState):
+ * dom/KeyboardEvent.h:
+ * dom/KeyboardEvent.idl:
+ * dom/MouseRelatedEvent.cpp:
+ (WebCore::MouseRelatedEvent::MouseRelatedEvent):
+ * dom/MouseRelatedEvent.h:
+ * dom/UIEvent.cpp:
+ (WebCore::UIEvent::UIEvent):
+ * dom/UIEvent.h:
+ (WebCore::UIEvent::create): Deleted.
+ * dom/UIEventInit.h: Added.
+ (WebCore::UIEventInit::UIEventInit):
+ * dom/UIEventInit.idl: Added.
+ * dom/UIEventWithKeyState.h:
+ (WebCore::UIEventWithKeyState::altGraphKey):
+ (WebCore::UIEventWithKeyState::capsLockKey):
+ (WebCore::UIEventWithKeyState::UIEventWithKeyState):
+ (WebCore::UIEventWithKeyState::ctrlKey): Deleted.
+ (WebCore::UIEventWithKeyState::shiftKey): Deleted.
+ (WebCore::UIEventWithKeyState::altKey): Deleted.
+ (WebCore::UIEventWithKeyState::metaKey): Deleted.
+
2016-10-09 Youenn Fablet <[email protected]>
Promise attribute getters should reject promises in case of casted-this errors
Modified: trunk/Source/WebCore/DerivedSources.cpp (206970 => 206971)
--- trunk/Source/WebCore/DerivedSources.cpp 2016-10-09 22:47:57 UTC (rev 206970)
+++ trunk/Source/WebCore/DerivedSources.cpp 2016-10-09 23:11:56 UTC (rev 206971)
@@ -190,6 +190,7 @@
#include "JSErrorEvent.cpp"
#include "JSEvent.cpp"
#include "JSEventInit.cpp"
+#include "JSEventModifierInit.cpp"
#include "JSEventSource.cpp"
#include "JSEventTarget.cpp"
#include "JSFetchBody.cpp"
@@ -630,6 +631,7 @@
#include "JSTransitionEvent.cpp"
#include "JSTreeWalker.cpp"
#include "JSUIEvent.cpp"
+#include "JSUIEventInit.cpp"
#include "JSUIRequestEvent.cpp"
#include "JSURLUtils.cpp"
#if ENABLE(USER_MESSAGE_HANDLERS)
Modified: trunk/Source/WebCore/DerivedSources.make (206970 => 206971)
--- trunk/Source/WebCore/DerivedSources.make 2016-10-09 22:47:57 UTC (rev 206970)
+++ trunk/Source/WebCore/DerivedSources.make 2016-10-09 23:11:56 UTC (rev 206971)
@@ -310,6 +310,7 @@
$(WebCore)/dom/Event.idl \
$(WebCore)/dom/EventInit.idl \
$(WebCore)/dom/EventListener.idl \
+ $(WebCore)/dom/EventModifierInit.idl \
$(WebCore)/dom/EventTarget.idl \
$(WebCore)/dom/FocusEvent.idl \
$(WebCore)/dom/GlobalEventHandlers.idl \
@@ -348,6 +349,7 @@
$(WebCore)/dom/TransitionEvent.idl \
$(WebCore)/dom/TreeWalker.idl \
$(WebCore)/dom/UIEvent.idl \
+ $(WebCore)/dom/UIEventInit.idl \
$(WebCore)/dom/WebKitAnimationEvent.idl \
$(WebCore)/dom/WebKitNamedFlow.idl \
$(WebCore)/dom/WebKitTransitionEvent.idl \
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (206970 => 206971)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-10-09 22:47:57 UTC (rev 206970)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-10-09 23:11:56 UTC (rev 206971)
@@ -2931,6 +2931,8 @@
83E359A21BB1031D002CEB98 /* JSHTMLTimeElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E359A01BB1031D002CEB98 /* JSHTMLTimeElement.h */; };
83E359A31BB1031D002CEB98 /* JSHTMLTimeElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83E359A11BB1031D002CEB98 /* JSHTMLTimeElement.cpp */; };
83F1206B1B8C104700D75F63 /* JSNodeFilterCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83F1206A1B8C103600D75F63 /* JSNodeFilterCustom.cpp */; };
+ 83FE7CA71DA9F1A70037237C /* UIEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FE7CA41DA9F1660037237C /* UIEventInit.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 83FE7CA81DA9F1B60037237C /* EventModifierInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FE7CA31DA9F1650037237C /* EventModifierInit.h */; settings = {ATTRIBUTES = (Private, ); }; };
8419D2A7120D92D000141F8F /* SVGPathByteStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 8419D2A4120D92D000141F8F /* SVGPathByteStream.h */; };
8419D2A8120D92D000141F8F /* SVGPathByteStreamBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8419D2A5120D92D000141F8F /* SVGPathByteStreamBuilder.cpp */; };
8419D2A9120D92D000141F8F /* SVGPathByteStreamBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 8419D2A6120D92D000141F8F /* SVGPathByteStreamBuilder.h */; };
@@ -10065,6 +10067,10 @@
83D35AEB1C7187ED00F70D5A /* XMLHttpRequestEventTarget.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XMLHttpRequestEventTarget.idl; sourceTree = "<group>"; };
83D35AEF1C718D8400F70D5A /* JSXMLHttpRequestEventTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLHttpRequestEventTarget.cpp; sourceTree = "<group>"; };
83D35AF01C718D8400F70D5A /* JSXMLHttpRequestEventTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSXMLHttpRequestEventTarget.h; sourceTree = "<group>"; };
+ 83E045EC1DAA104F00B0D8B9 /* JSEventModifierInit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventModifierInit.cpp; sourceTree = "<group>"; };
+ 83E045ED1DAA104F00B0D8B9 /* JSEventModifierInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEventModifierInit.h; sourceTree = "<group>"; };
+ 83E045EE1DAA104F00B0D8B9 /* JSUIEventInit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSUIEventInit.cpp; sourceTree = "<group>"; };
+ 83E045EF1DAA104F00B0D8B9 /* JSUIEventInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSUIEventInit.h; sourceTree = "<group>"; };
83E359A01BB1031D002CEB98 /* JSHTMLTimeElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLTimeElement.h; sourceTree = "<group>"; };
83E359A11BB1031D002CEB98 /* JSHTMLTimeElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLTimeElement.cpp; sourceTree = "<group>"; };
83E959E11B8BC22B004D9385 /* NativeNodeFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeNodeFilter.h; sourceTree = "<group>"; };
@@ -10073,6 +10079,10 @@
83F1206A1B8C103600D75F63 /* JSNodeFilterCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNodeFilterCustom.cpp; sourceTree = "<group>"; };
83F570AD1C53268E007FD6CB /* JSXMLDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSXMLDocument.h; sourceTree = "<group>"; };
83F570AE1C53268E007FD6CB /* JSXMLDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLDocument.cpp; sourceTree = "<group>"; };
+ 83FE7CA31DA9F1650037237C /* EventModifierInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventModifierInit.h; sourceTree = "<group>"; };
+ 83FE7CA41DA9F1660037237C /* UIEventInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIEventInit.h; sourceTree = "<group>"; };
+ 83FE7CA51DA9F1660037237C /* UIEventInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = UIEventInit.idl; sourceTree = "<group>"; };
+ 83FE7CA61DA9F1660037237C /* EventModifierInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EventModifierInit.idl; sourceTree = "<group>"; };
8419D2A4120D92D000141F8F /* SVGPathByteStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathByteStream.h; sourceTree = "<group>"; };
8419D2A5120D92D000141F8F /* SVGPathByteStreamBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathByteStreamBuilder.cpp; sourceTree = "<group>"; };
8419D2A6120D92D000141F8F /* SVGPathByteStreamBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathByteStreamBuilder.h; sourceTree = "<group>"; };
@@ -19699,6 +19709,8 @@
14E8378D09F85D4F00B85AE4 /* JSEvent.h */,
836D032B1DA8A13200FFD96B /* JSEventInit.cpp */,
836D032C1DA8A13200FFD96B /* JSEventInit.h */,
+ 83E045EC1DAA104F00B0D8B9 /* JSEventModifierInit.cpp */,
+ 83E045ED1DAA104F00B0D8B9 /* JSEventModifierInit.h */,
C6A703325C9D0B6CDCBC4D78 /* JSEventTarget.cpp */,
5FC7DC26CFE2563200B85AE5 /* JSEventTarget.h */,
B6D9D27A14EAC0860090D75E /* JSFocusEvent.cpp */,
@@ -19741,6 +19753,8 @@
E17B491F16A9B8FF001C8839 /* JSTransitionEvent.h */,
A86629CA09DA2B47009633A5 /* JSUIEvent.cpp */,
A86629C909DA2B47009633A5 /* JSUIEvent.h */,
+ 83E045EE1DAA104F00B0D8B9 /* JSUIEventInit.cpp */,
+ 83E045EF1DAA104F00B0D8B9 /* JSUIEventInit.h */,
31C0FF390E4CEFAC007D6FE5 /* JSWebKitAnimationEvent.cpp */,
31C0FF3A0E4CEFAC007D6FE5 /* JSWebKitAnimationEvent.h */,
31C0FF3B0E4CEFAC007D6FE5 /* JSWebKitTransitionEvent.cpp */,
@@ -23124,6 +23138,8 @@
85AFA7410AAF298400E84305 /* EventListener.idl */,
AD4495F1141FC08900541EDF /* EventListenerMap.cpp */,
AD4495F2141FC08900541EDF /* EventListenerMap.h */,
+ 83FE7CA31DA9F1650037237C /* EventModifierInit.h */,
+ 83FE7CA61DA9F1660037237C /* EventModifierInit.idl */,
939885C108B7E3D100E707C4 /* EventNames.cpp */,
939885C208B7E3D100E707C4 /* EventNames.h */,
BC9A6142146859D9006057FD /* EventNames.in */,
@@ -23350,6 +23366,8 @@
85031B370A44EFC700F992E0 /* UIEvent.cpp */,
85031B380A44EFC700F992E0 /* UIEvent.h */,
141B94EE09EC425A000E9413 /* UIEvent.idl */,
+ 83FE7CA41DA9F1660037237C /* UIEventInit.h */,
+ 83FE7CA51DA9F1660037237C /* UIEventInit.idl */,
93354A3B0B24F8C9003F6DEA /* UIEventWithKeyState.cpp */,
85031B390A44EFC700F992E0 /* UIEventWithKeyState.h */,
A769E96916689D0C005D4529 /* UserActionElementSet.cpp */,
@@ -24208,6 +24226,7 @@
BCEA4790097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h in Headers */,
9DAC7C551AF2CAA200437C44 /* CSSContentDistributionValue.h in Headers */,
2D8FEBDD143E3EF70072502B /* CSSCrossfadeValue.h in Headers */,
+ 83FE7CA71DA9F1A70037237C /* UIEventInit.h in Headers */,
AA21ECCD0ABF0FC6002B834C /* CSSCursorImageValue.h in Headers */,
BC779E141BB215BB00CAA8BF /* CSSCustomPropertyValue.h in Headers */,
4A9CC81816BB9AC600EC645A /* CSSDefaultStyleSheets.h in Headers */,
@@ -24366,6 +24385,7 @@
26A517FE1AB92238006335DF /* DFAMinimizer.h in Headers */,
267725FF1A5B3AD9003C24DD /* DFANode.h in Headers */,
CD19A2681A13E700008D650E /* DiagnosticLoggingClient.h in Headers */,
+ 83FE7CA81DA9F1B60037237C /* EventModifierInit.h in Headers */,
46FCB6181A70820E00C5A21E /* DiagnosticLoggingKeys.h in Headers */,
8372DB311A6780A800C697C5 /* DiagnosticLoggingResultType.h in Headers */,
CECADFC7153778FF00E37068 /* DictationAlternative.h in Headers */,
Added: trunk/Source/WebCore/dom/EventModifierInit.h (0 => 206971)
--- trunk/Source/WebCore/dom/EventModifierInit.h (rev 0)
+++ trunk/Source/WebCore/dom/EventModifierInit.h 2016-10-09 23:11:56 UTC (rev 206971)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2016 Apple 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.
+ */
+
+#pragma once
+
+#include "UIEventInit.h"
+
+namespace WebCore {
+
+struct EventModifierInit : public UIEventInit {
+ EventModifierInit() = default;
+
+ EventModifierInit(bool bubbles, bool cancelable, bool composed, RefPtr<DOMWindow>&& view, int detail,
+ bool ctrlKey, bool shiftKey, bool altKey, bool metaKey, bool modifierAltGraph, bool modifierCapsLock)
+ : UIEventInit(bubbles, cancelable, composed, WTFMove(view), detail)
+ , ctrlKey(ctrlKey)
+ , shiftKey(shiftKey)
+ , altKey(altKey)
+ , metaKey(metaKey)
+ , modifierAltGraph(modifierAltGraph)
+ , modifierCapsLock(modifierCapsLock)
+ { }
+
+ bool ctrlKey { false };
+ bool shiftKey { false };
+ bool altKey { false };
+ bool metaKey { false };
+
+ bool modifierAltGraph { false };
+ bool modifierCapsLock { false };
+};
+
+}
Added: trunk/Source/WebCore/dom/EventModifierInit.idl (0 => 206971)
--- trunk/Source/WebCore/dom/EventModifierInit.idl (rev 0)
+++ trunk/Source/WebCore/dom/EventModifierInit.idl 2016-10-09 23:11:56 UTC (rev 206971)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2016 Apple 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. ``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
+ * 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.
+ *
+ */
+
+dictionary EventModifierInit : UIEventInit {
+ boolean ctrlKey = false;
+ boolean shiftKey = false;
+ boolean altKey = false;
+ boolean metaKey = false;
+
+ boolean modifierAltGraph = false;
+ boolean modifierCapsLock = false;
+
+ // FIXME: The following members are in the specification but are not implemented.
+ // boolean modifierFn = false;
+ // boolean modifierFnLock = false;
+ // boolean modifierHyper = false;
+ // boolean modifierNumLock = false;
+ // boolean modifierScrollLock = false;
+ // boolean modifierSuper = false;
+ // boolean modifierSymbol = false;
+ // boolean modifierSymbolLock = false;
+};
Modified: trunk/Source/WebCore/dom/KeyboardEvent.cpp (206970 => 206971)
--- trunk/Source/WebCore/dom/KeyboardEvent.cpp 2016-10-09 22:47:57 UTC (rev 206970)
+++ trunk/Source/WebCore/dom/KeyboardEvent.cpp 2016-10-09 23:11:56 UTC (rev 206971)
@@ -95,8 +95,9 @@
KeyboardEvent::KeyboardEvent() = default;
KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, DOMWindow* view)
- : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()),
- true, true, key.timestamp(), view, 0, key.ctrlKey(), key.altKey(), key.shiftKey(), key.metaKey())
+ : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type())
+ , true, true, key.timestamp(), view, 0, key.ctrlKey(), key.altKey(), key.shiftKey()
+ , key.metaKey(), false, key.modifiers().contains(PlatformEvent::Modifier::CapsLockKey))
, m_keyEvent(std::make_unique<PlatformKeyboardEvent>(key))
#if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
, m_key(key.key())
@@ -107,8 +108,6 @@
, m_keyIdentifier(key.keyIdentifier())
, m_location(keyLocationCode(key))
, m_repeat(key.isAutoRepeat())
- , m_altGraphKey(false)
- , m_capsLockKey(key.modifiers().contains(PlatformEvent::Modifier::CapsLockKey))
, m_isComposing(view && view->frame() && view->frame()->editor().hasComposition())
#if PLATFORM(COCOA)
#if USE(APPKIT)
@@ -127,8 +126,8 @@
{
}
-KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const KeyboardEventInit& initializer)
- : UIEventWithKeyState(eventType, initializer)
+KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const Init& initializer, IsTrusted isTrusted)
+ : UIEventWithKeyState(eventType, initializer, isTrusted)
#if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
, m_key(initializer.key)
#endif
@@ -138,8 +137,6 @@
, m_keyIdentifier(initializer.keyIdentifier)
, m_location(initializer.location)
, m_repeat(initializer.repeat)
- , m_altGraphKey(false) // FIXME: should be initialized from initializer.modifierAltGraph.
- , m_capsLockKey(false) // FIXME: should be initialized from initializer.modifierCapsLock.
, m_isComposing(initializer.isComposing)
#if PLATFORM(COCOA)
, m_handledByInputMethod(false)
@@ -182,7 +179,7 @@
if (keyIdentifier == "AltGraph")
return altGraphKey();
if (keyIdentifier == "CapsLock")
- return m_capsLockKey;
+ return capsLockKey();
// FIXME: The specification also has Fn, FnLock, Hyper, NumLock, Super, ScrollLock, Symbol, SymbolLock.
return false;
}
Modified: trunk/Source/WebCore/dom/KeyboardEvent.h (206970 => 206971)
--- trunk/Source/WebCore/dom/KeyboardEvent.h 2016-10-09 22:47:57 UTC (rev 206970)
+++ trunk/Source/WebCore/dom/KeyboardEvent.h 2016-10-09 23:11:56 UTC (rev 206971)
@@ -23,6 +23,7 @@
#pragma once
+#include "EventModifierInit.h"
#include "KeypressCommand.h"
#include "UIEventWithKeyState.h"
#include <memory>
@@ -33,19 +34,6 @@
class Node;
class PlatformKeyboardEvent;
-struct KeyboardEventInit : public UIEventWithKeyStateInit {
-#if ENABLE(KEYBOARD_KEY_ATTRIBUTE)
- String key;
-#endif
-#if ENABLE(KEYBOARD_CODE_ATTRIBUTE)
- String code;
-#endif
- String keyIdentifier;
- unsigned location { 0 };
- bool repeat { false };
- bool isComposing { false };
-};
-
class KeyboardEvent final : public UIEventWithKeyState {
public:
enum KeyLocationCode {
@@ -65,9 +53,33 @@
return adoptRef(*new KeyboardEvent);
}
- static Ref<KeyboardEvent> createForBindings(const AtomicString& type, const KeyboardEventInit& initializer)
+ struct Init : public EventModifierInit {
+ Init(bool bubbles, bool cancelable, bool composed, RefPtr<DOMWindow>&& view, int detail,
+ bool ctrlKey, bool shiftKey, bool altKey, bool metaKey, bool modifierAltGraph, bool modifierCapsLock,
+ String key, String code, Optional<unsigned> location, bool repeat, bool isComposing, String keyIdentifier,
+ Optional<unsigned> keyLocation)
+ : EventModifierInit(bubbles, cancelable, composed, WTFMove(view), detail, ctrlKey, shiftKey, altKey, metaKey, modifierAltGraph, modifierCapsLock)
+ , key(key)
+ , code(code)
+ , location(location ? *location : keyLocation.valueOr(DOM_KEY_LOCATION_STANDARD))
+ , repeat(repeat)
+ , isComposing(isComposing)
+ , keyIdentifier(keyIdentifier)
+ { }
+
+ String key;
+ String code;
+ unsigned location;
+ bool repeat;
+ bool isComposing;
+
+ // Legacy.
+ String keyIdentifier;
+ };
+
+ static Ref<KeyboardEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No)
{
- return adoptRef(*new KeyboardEvent(type, initializer));
+ return adoptRef(*new KeyboardEvent(type, initializer, isTrusted));
}
// FIXME: This method should be get ride of in the future.
@@ -95,8 +107,6 @@
bool repeat() const { return m_repeat; }
WEBCORE_EXPORT bool getModifierState(const String& keyIdentifier) const;
-
- bool altGraphKey() const { return m_altGraphKey; }
const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent.get(); }
@@ -120,7 +130,7 @@
private:
WEBCORE_EXPORT KeyboardEvent();
WEBCORE_EXPORT KeyboardEvent(const PlatformKeyboardEvent&, DOMWindow*);
- KeyboardEvent(const AtomicString&, const KeyboardEventInit&);
+ KeyboardEvent(const AtomicString&, const Init&, IsTrusted);
// FIXME: This method should be get rid of in the future.
// DO NOT USE IT!
KeyboardEvent(WTF::HashTableDeletedValueType);
@@ -135,8 +145,6 @@
String m_keyIdentifier;
unsigned m_location { DOM_KEY_LOCATION_STANDARD };
bool m_repeat { false };
- bool m_altGraphKey { false };
- bool m_capsLockKey { false };
bool m_isComposing { false };
#if PLATFORM(COCOA)
Modified: trunk/Source/WebCore/dom/KeyboardEvent.idl (206970 => 206971)
--- trunk/Source/WebCore/dom/KeyboardEvent.idl 2016-10-09 22:47:57 UTC (rev 206970)
+++ trunk/Source/WebCore/dom/KeyboardEvent.idl 2016-10-09 23:11:56 UTC (rev 206971)
@@ -19,8 +19,7 @@
*/
[
- ConstructorConditional=DOM4_EVENTS_CONSTRUCTOR,
- ConstructorTemplate=Event,
+ Constructor(DOMString type, optional KeyboardEventInit eventInitDict),
] interface KeyboardEvent : UIEvent {
const unsigned long DOM_KEY_LOCATION_STANDARD = 0x00;
@@ -28,23 +27,23 @@
const unsigned long DOM_KEY_LOCATION_RIGHT = 0x02;
const unsigned long DOM_KEY_LOCATION_NUMPAD = 0x03;
- [InitializedByEventConstructor, Conditional=KEYBOARD_KEY_ATTRIBUTE] readonly attribute DOMString key;
- [InitializedByEventConstructor, Conditional=KEYBOARD_CODE_ATTRIBUTE] readonly attribute DOMString code;
- [InitializedByEventConstructor] readonly attribute unsigned long location;
+ [Conditional=KEYBOARD_KEY_ATTRIBUTE] readonly attribute DOMString key;
+ [Conditional=KEYBOARD_CODE_ATTRIBUTE] readonly attribute DOMString code;
+ readonly attribute unsigned long location;
- [InitializedByEventConstructor] readonly attribute boolean ctrlKey;
- [InitializedByEventConstructor] readonly attribute boolean shiftKey;
- [InitializedByEventConstructor] readonly attribute boolean altKey;
- [InitializedByEventConstructor] readonly attribute boolean metaKey;
- [InitializedByEventConstructor] readonly attribute boolean repeat;
+ readonly attribute boolean ctrlKey;
+ readonly attribute boolean shiftKey;
+ readonly attribute boolean altKey;
+ readonly attribute boolean metaKey;
+ readonly attribute boolean repeat;
- [InitializedByEventConstructor] readonly attribute boolean isComposing;
+ readonly attribute boolean isComposing;
boolean getModifierState(DOMString keyArg);
// Everything below is legacy.
- [InitializedByEventConstructor] readonly attribute DOMString keyIdentifier;
- [InitializedByEventConstructor, ImplementedAs=location] readonly attribute unsigned long keyLocation;
+ readonly attribute DOMString keyIdentifier;
+ [ImplementedAs=location] readonly attribute unsigned long keyLocation;
readonly attribute boolean altGraphKey;
// FIXME: this does not match the version in the DOM spec.
@@ -53,3 +52,16 @@
optional DOMWindow? view = null, optional DOMString keyIdentifier = "undefined", optional unsigned long location = 0,
optional boolean ctrlKey = false, optional boolean altKey = false, optional boolean shiftKey = false, optional boolean metaKey = false, optional boolean altGraphKey = false);
};
+
+dictionary KeyboardEventInit : EventModifierInit {
+ DOMString key = "";
+ DOMString code = "";
+ unsigned long location;
+ boolean repeat = false;
+ boolean isComposing = false;
+
+ // This members are not in the specification but are needed to initialize the corresponding legacy
+ // attributes we still support on KeyboardEvent for backward compatibility.
+ DOMString keyIdentifier = "";
+ unsigned long keyLocation;
+};
Modified: trunk/Source/WebCore/dom/MouseRelatedEvent.cpp (206970 => 206971)
--- trunk/Source/WebCore/dom/MouseRelatedEvent.cpp 2016-10-09 22:47:57 UTC (rev 206970)
+++ trunk/Source/WebCore/dom/MouseRelatedEvent.cpp 2016-10-09 23:11:56 UTC (rev 206971)
@@ -61,7 +61,7 @@
const IntPoint& movementDelta,
#endif
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool isSimulated)
- : UIEventWithKeyState(eventType, canBubble, cancelable, timestamp, DOMWindow, detail, ctrlKey, altKey, shiftKey, metaKey)
+ : UIEventWithKeyState(eventType, canBubble, cancelable, timestamp, DOMWindow, detail, ctrlKey, altKey, shiftKey, metaKey, false, false)
, m_screenLocation(screenLocation)
#if ENABLE(POINTER_LOCK)
, m_movementDelta(movementDelta)
Modified: trunk/Source/WebCore/dom/MouseRelatedEvent.h (206970 => 206971)
--- trunk/Source/WebCore/dom/MouseRelatedEvent.h 2016-10-09 22:47:57 UTC (rev 206970)
+++ trunk/Source/WebCore/dom/MouseRelatedEvent.h 2016-10-09 23:11:56 UTC (rev 206971)
@@ -28,7 +28,7 @@
namespace WebCore {
-struct MouseRelatedEventInit : public UIEventWithKeyStateInit {
+struct MouseRelatedEventInit : public EventModifierInit {
int screenX { 0 };
int screenY { 0 };
};
Modified: trunk/Source/WebCore/dom/UIEvent.cpp (206970 => 206971)
--- trunk/Source/WebCore/dom/UIEvent.cpp 2016-10-09 22:47:57 UTC (rev 206970)
+++ trunk/Source/WebCore/dom/UIEvent.cpp 2016-10-09 23:11:56 UTC (rev 206971)
@@ -46,8 +46,8 @@
{
}
-UIEvent::UIEvent(const AtomicString& eventType, const UIEventInit& initializer)
- : Event(eventType, initializer)
+UIEvent::UIEvent(const AtomicString& eventType, const UIEventInit& initializer, IsTrusted isTrusted)
+ : Event(eventType, initializer, isTrusted)
, m_view(initializer.view.get())
, m_detail(initializer.detail)
{
Modified: trunk/Source/WebCore/dom/UIEvent.h (206970 => 206971)
--- trunk/Source/WebCore/dom/UIEvent.h 2016-10-09 22:47:57 UTC (rev 206970)
+++ trunk/Source/WebCore/dom/UIEvent.h 2016-10-09 23:11:56 UTC (rev 206971)
@@ -25,6 +25,7 @@
#include "DOMWindow.h"
#include "Event.h"
+#include "UIEventInit.h"
namespace WebCore {
@@ -31,11 +32,6 @@
// FIXME: Remove this when no one is depending on it anymore.
typedef DOMWindow AbstractView;
-struct UIEventInit : public EventInit {
- RefPtr<DOMWindow> view;
- int detail { 0 };
-};
-
class UIEvent : public Event {
public:
static Ref<UIEvent> create(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, int detail)
@@ -74,7 +70,7 @@
UIEvent();
UIEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, int detail);
UIEvent(const AtomicString& type, bool canBubble, bool cancelable, double timestamp, DOMWindow*, int detail);
- UIEvent(const AtomicString&, const UIEventInit&);
+ UIEvent(const AtomicString&, const UIEventInit&, IsTrusted = IsTrusted::No);
private:
bool isUIEvent() const final;
Added: trunk/Source/WebCore/dom/UIEventInit.h (0 => 206971)
--- trunk/Source/WebCore/dom/UIEventInit.h (rev 0)
+++ trunk/Source/WebCore/dom/UIEventInit.h 2016-10-09 23:11:56 UTC (rev 206971)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2016 Apple 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.
+ */
+
+#pragma once
+
+#include "DOMWindow.h"
+#include "EventInit.h"
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+struct UIEventInit : public EventInit {
+ UIEventInit() = default;
+ UIEventInit(bool bubbles, bool cancelable, bool composed, RefPtr<DOMWindow>&& view, int detail)
+ : EventInit(bubbles, cancelable, composed)
+ , view(WTFMove(view))
+ , detail(detail)
+ { }
+
+ RefPtr<DOMWindow> view;
+ int detail { 0 };
+};
+
+}
Added: trunk/Source/WebCore/dom/UIEventInit.idl (0 => 206971)
--- trunk/Source/WebCore/dom/UIEventInit.idl (rev 0)
+++ trunk/Source/WebCore/dom/UIEventInit.idl 2016-10-09 23:11:56 UTC (rev 206971)
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2016 Apple 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.
+ */
+
+dictionary UIEventInit : EventInit {
+ DOMWindow? view = null;
+ long detail = 0;
+};
Modified: trunk/Source/WebCore/dom/UIEventWithKeyState.h (206970 => 206971)
--- trunk/Source/WebCore/dom/UIEventWithKeyState.h 2016-10-09 22:47:57 UTC (rev 206970)
+++ trunk/Source/WebCore/dom/UIEventWithKeyState.h 2016-10-09 23:11:56 UTC (rev 206971)
@@ -24,17 +24,11 @@
#ifndef UIEventWithKeyState_h
#define UIEventWithKeyState_h
+#include "EventModifierInit.h"
#include "UIEvent.h"
namespace WebCore {
-struct UIEventWithKeyStateInit : public UIEventInit {
- bool ctrlKey { false };
- bool altKey { false };
- bool shiftKey { false };
- bool metaKey { false };
-};
-
class UIEventWithKeyState : public UIEvent {
public:
bool ctrlKey() const { return m_ctrlKey; }
@@ -41,15 +35,11 @@
bool shiftKey() const { return m_shiftKey; }
bool altKey() const { return m_altKey; }
bool metaKey() const { return m_metaKey; }
+ bool altGraphKey() const { return m_altGraphKey; }
+ bool capsLockKey() const { return m_capsLockKey; }
protected:
- UIEventWithKeyState()
- : m_ctrlKey(false)
- , m_altKey(false)
- , m_shiftKey(false)
- , m_metaKey(false)
- {
- }
+ UIEventWithKeyState() = default;
UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, int detail, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
: UIEvent(type, canBubble, cancelable, view, detail)
@@ -60,29 +50,36 @@
{
}
- UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, double timestamp, DOMWindow* view, int detail, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
- : UIEvent(type, canBubble, cancelable, timestamp, view, detail)
- , m_ctrlKey(ctrlKey)
- , m_altKey(altKey)
- , m_shiftKey(shiftKey)
- , m_metaKey(metaKey)
+ UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, double timestamp, DOMWindow* view,
+ int detail, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey, bool capsLockKey)
+ : UIEvent(type, canBubble, cancelable, timestamp, view, detail)
+ , m_ctrlKey(ctrlKey)
+ , m_altKey(altKey)
+ , m_shiftKey(shiftKey)
+ , m_metaKey(metaKey)
+ , m_altGraphKey(altGraphKey)
+ , m_capsLockKey(capsLockKey)
{
}
- UIEventWithKeyState(const AtomicString& type, const UIEventWithKeyStateInit& initializer)
- : UIEvent(type, initializer)
+ UIEventWithKeyState(const AtomicString& type, const EventModifierInit& initializer, IsTrusted isTrusted = IsTrusted::No)
+ : UIEvent(type, initializer, isTrusted)
, m_ctrlKey(initializer.ctrlKey)
, m_altKey(initializer.altKey)
, m_shiftKey(initializer.shiftKey)
, m_metaKey(initializer.metaKey)
+ , m_altGraphKey(initializer.modifierAltGraph)
+ , m_capsLockKey(initializer.modifierCapsLock)
{
}
// Expose these so init functions can set them.
- bool m_ctrlKey : 1;
- bool m_altKey : 1;
- bool m_shiftKey : 1;
- bool m_metaKey : 1;
+ bool m_ctrlKey { false };
+ bool m_altKey { false };
+ bool m_shiftKey { false };
+ bool m_metaKey { false };
+ bool m_altGraphKey { false };
+ bool m_capsLockKey { false };
};
WEBCORE_EXPORT UIEventWithKeyState* findEventWithKeyState(Event*);