Changeset 206971 in webkit
- Timestamp:
- Oct 9, 2016 4:11:56 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r206969 r206971 1 2016-10-09 Chris Dumez <cdumez@apple.com> 2 3 Update KeyboardEvent to stop using legacy [ConstructorTemplate=Event] 4 https://bugs.webkit.org/show_bug.cgi?id=163176 5 6 Reviewed by Darin Adler. 7 8 Rebaseline existing test now that the exception message is slightly 9 different in some cases. Also add test coverage for passing 10 modifierAltGraph / modifierCapsLock in initialization dictionary. 11 12 * fast/events/constructors/keyboard-event-constructor-expected.txt: 13 * fast/events/constructors/keyboard-event-constructor.html: 14 1 15 2016-10-09 Michael Catanzaro <mcatanzaro@igalia.com> 2 16 -
trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor-expected.txt
r206803 r206971 26 26 PASS new KeyboardEvent('eventType', { isComposing: false }).isComposing is false 27 27 PASS new KeyboardEvent('eventType', { isComposing: true }).isComposing is true 28 PASS new KeyboardEvent('eventType', { view: testObject }).view threw exception TypeError: Dictionary member is not of type Window.29 PASS new KeyboardEvent('eventType', { view: document }).view threw exception TypeError: Dictionary member is not of type Window.28 PASS new KeyboardEvent('eventType', { view: testObject }).view threw exception TypeError: Type error. 29 PASS new KeyboardEvent('eventType', { view: document }).view threw exception TypeError: Type error. 30 30 PASS new KeyboardEvent('eventType', { view: undefined }).view is null 31 31 PASS new KeyboardEvent('eventType', { view: null }).view is null 32 PASS new KeyboardEvent('eventType', { view: false }).view threw exception TypeError: Dictionary member is not of type Window.33 PASS new KeyboardEvent('eventType', { view: true }).view threw exception TypeError: Dictionary member is not of type Window.34 PASS new KeyboardEvent('eventType', { view: '' }).view threw exception TypeError: Dictionary member is not of type Window.35 PASS new KeyboardEvent('eventType', { view: 'chocolate' }).view threw exception TypeError: Dictionary member is not of type Window.36 PASS new KeyboardEvent('eventType', { view: 12345 }).view threw exception TypeError: Dictionary member is not of type Window.37 PASS new KeyboardEvent('eventType', { view: 18446744073709551615 }).view threw exception TypeError: Dictionary member is not of type Window.38 PASS new KeyboardEvent('eventType', { view: NaN }).view threw exception TypeError: Dictionary member is not of type Window.39 PASS new KeyboardEvent('eventType', { view: {valueOf: function () { return window; } } }).view threw exception TypeError: Dictionary member is not of type Window.40 PASS new KeyboardEvent('eventType', { get view() { return 123; } }).view threw exception TypeError: Dictionary member is not of type Window.32 PASS new KeyboardEvent('eventType', { view: false }).view threw exception TypeError: Type error. 33 PASS new KeyboardEvent('eventType', { view: true }).view threw exception TypeError: Type error. 34 PASS new KeyboardEvent('eventType', { view: '' }).view threw exception TypeError: Type error. 35 PASS new KeyboardEvent('eventType', { view: 'chocolate' }).view threw exception TypeError: Type error. 36 PASS new KeyboardEvent('eventType', { view: 12345 }).view threw exception TypeError: Type error. 37 PASS new KeyboardEvent('eventType', { view: 18446744073709551615 }).view threw exception TypeError: Type error. 38 PASS new KeyboardEvent('eventType', { view: NaN }).view threw exception TypeError: Type error. 39 PASS new KeyboardEvent('eventType', { view: {valueOf: function () { return window; } } }).view threw exception TypeError: Type error. 40 PASS new KeyboardEvent('eventType', { get view() { return 123; } }).view threw exception TypeError: Type error. 41 41 PASS new KeyboardEvent('eventType', { get view() { throw 'KeyboardEvent Error'; } }) threw exception KeyboardEvent Error. 42 42 PASS new KeyboardEvent('eventType', { keyIdentifier: 'koakuma' }).keyIdentifier is "koakuma" 43 43 PASS new KeyboardEvent('eventType', { keyIdentifier: '' }).keyIdentifier is "" 44 PASS new KeyboardEvent('eventType', { keyIdentifier: undefined }).keyIdentifier is " undefined"44 PASS new KeyboardEvent('eventType', { keyIdentifier: undefined }).keyIdentifier is "" 45 45 PASS new KeyboardEvent('eventType', { keyIdentifier: null }).keyIdentifier is "null" 46 46 PASS new KeyboardEvent('eventType', { keyIdentifier: false }).keyIdentifier is "false" … … 107 107 PASS new KeyboardEvent('eventType', { metaKey: false }).metaKey is false 108 108 PASS new KeyboardEvent('eventType', { metaKey: true }).metaKey is true 109 PASS new KeyboardEvent('eventType', { modifierAltGraph: true }).getModifierState('AltGraph') is true 110 PASS new KeyboardEvent('eventType', { modifierCapsLock: true }).getModifierState('CapsLock') is true 109 111 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 110 112 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 -
trunk/LayoutTests/fast/events/constructors/keyboard-event-constructor.html
r206803 r206971 69 69 70 70 // Non-strings. 71 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: undefined }).keyIdentifier", " undefined");71 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: undefined }).keyIdentifier", ""); 72 72 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: null }).keyIdentifier", "null"); 73 73 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: false }).keyIdentifier", "false"); … … 122 122 }); 123 123 124 shouldBeTrue("new KeyboardEvent('eventType', { modifierAltGraph: true }).getModifierState('AltGraph')"); 125 shouldBeTrue("new KeyboardEvent('eventType', { modifierCapsLock: true }).getModifierState('CapsLock')"); 126 124 127 // All initializers are passed. 125 128 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"); -
trunk/LayoutTests/platform/ios-simulator/fast/events/constructors/keyboard-event-constructor-expected.txt
r206803 r206971 26 26 PASS new KeyboardEvent('eventType', { isComposing: false }).isComposing is false 27 27 PASS new KeyboardEvent('eventType', { isComposing: true }).isComposing is true 28 PASS new KeyboardEvent('eventType', { view: testObject }).view threw exception TypeError: Dictionary member is not of type Window.29 PASS new KeyboardEvent('eventType', { view: document }).view threw exception TypeError: Dictionary member is not of type Window.28 PASS new KeyboardEvent('eventType', { view: testObject }).view threw exception TypeError: Type error. 29 PASS new KeyboardEvent('eventType', { view: document }).view threw exception TypeError: Type error. 30 30 PASS new KeyboardEvent('eventType', { view: undefined }).view is null 31 31 PASS new KeyboardEvent('eventType', { view: null }).view is null 32 PASS new KeyboardEvent('eventType', { view: false }).view threw exception TypeError: Dictionary member is not of type Window.33 PASS new KeyboardEvent('eventType', { view: true }).view threw exception TypeError: Dictionary member is not of type Window.34 PASS new KeyboardEvent('eventType', { view: '' }).view threw exception TypeError: Dictionary member is not of type Window.35 PASS new KeyboardEvent('eventType', { view: 'chocolate' }).view threw exception TypeError: Dictionary member is not of type Window.36 PASS new KeyboardEvent('eventType', { view: 12345 }).view threw exception TypeError: Dictionary member is not of type Window.37 PASS new KeyboardEvent('eventType', { view: 18446744073709551615 }).view threw exception TypeError: Dictionary member is not of type Window.38 PASS new KeyboardEvent('eventType', { view: NaN }).view threw exception TypeError: Dictionary member is not of type Window.39 PASS new KeyboardEvent('eventType', { view: {valueOf: function () { return window; } } }).view threw exception TypeError: Dictionary member is not of type Window.40 PASS new KeyboardEvent('eventType', { get view() { return 123; } }).view threw exception TypeError: Dictionary member is not of type Window.32 PASS new KeyboardEvent('eventType', { view: false }).view threw exception TypeError: Type error. 33 PASS new KeyboardEvent('eventType', { view: true }).view threw exception TypeError: Type error. 34 PASS new KeyboardEvent('eventType', { view: '' }).view threw exception TypeError: Type error. 35 PASS new KeyboardEvent('eventType', { view: 'chocolate' }).view threw exception TypeError: Type error. 36 PASS new KeyboardEvent('eventType', { view: 12345 }).view threw exception TypeError: Type error. 37 PASS new KeyboardEvent('eventType', { view: 18446744073709551615 }).view threw exception TypeError: Type error. 38 PASS new KeyboardEvent('eventType', { view: NaN }).view threw exception TypeError: Type error. 39 PASS new KeyboardEvent('eventType', { view: {valueOf: function () { return window; } } }).view threw exception TypeError: Type error. 40 PASS new KeyboardEvent('eventType', { get view() { return 123; } }).view threw exception TypeError: Type error. 41 41 PASS new KeyboardEvent('eventType', { get view() { throw 'KeyboardEvent Error'; } }) threw exception KeyboardEvent Error. 42 42 PASS new KeyboardEvent('eventType', { keyIdentifier: 'koakuma' }).keyIdentifier is "koakuma" 43 43 PASS new KeyboardEvent('eventType', { keyIdentifier: '' }).keyIdentifier is "" 44 PASS new KeyboardEvent('eventType', { keyIdentifier: undefined }).keyIdentifier is " undefined"44 PASS new KeyboardEvent('eventType', { keyIdentifier: undefined }).keyIdentifier is "" 45 45 PASS new KeyboardEvent('eventType', { keyIdentifier: null }).keyIdentifier is "null" 46 46 PASS new KeyboardEvent('eventType', { keyIdentifier: false }).keyIdentifier is "false" … … 107 107 PASS new KeyboardEvent('eventType', { metaKey: false }).metaKey is false 108 108 PASS new KeyboardEvent('eventType', { metaKey: true }).metaKey is true 109 PASS new KeyboardEvent('eventType', { modifierAltGraph: true }).getModifierState('AltGraph') is true 110 PASS new KeyboardEvent('eventType', { modifierCapsLock: true }).getModifierState('CapsLock') is true 109 111 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 110 112 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 -
trunk/Source/WebCore/CMakeLists.txt
r206963 r206971 400 400 dom/Event.idl 401 401 dom/EventInit.idl 402 dom/EventModifierInit.idl 402 403 dom/EventTarget.idl 403 404 dom/FocusEvent.idl … … 440 441 dom/TreeWalker.idl 441 442 dom/UIEvent.idl 443 dom/UIEventInit.idl 442 444 dom/WebKitAnimationEvent.idl 443 445 dom/WebKitNamedFlow.idl -
trunk/Source/WebCore/ChangeLog
r206966 r206971 1 2016-10-09 Chris Dumez <cdumez@apple.com> 2 3 Update KeyboardEvent to stop using legacy [ConstructorTemplate=Event] 4 https://bugs.webkit.org/show_bug.cgi?id=163176 5 6 Reviewed by Darin Adler. 7 8 Update KeyboardEvent to stop using legacy [ConstructorTemplate=Event] 9 and use a proper constructor instead, like in the specification: 10 - https://www.w3.org/TR/uievents/#interface-keyboardevent 11 12 Also add support for passing modifierAltGraph / modifierCapsLock 13 in the inialization dictionary as we support those modifiers via 14 getModifierState(). 15 16 No new tests, extended existing test. 17 18 * CMakeLists.txt: 19 * DerivedSources.cpp: 20 * DerivedSources.make: 21 * WebCore.xcodeproj/project.pbxproj: 22 * dom/EventModifierInit.h: Added. 23 (WebCore::EventModifierInit::EventModifierInit): 24 * dom/EventModifierInit.idl: Added. 25 * dom/KeyboardEvent.cpp: 26 (WebCore::KeyboardEvent::KeyboardEvent): 27 (WebCore::KeyboardEvent::getModifierState): 28 * dom/KeyboardEvent.h: 29 * dom/KeyboardEvent.idl: 30 * dom/MouseRelatedEvent.cpp: 31 (WebCore::MouseRelatedEvent::MouseRelatedEvent): 32 * dom/MouseRelatedEvent.h: 33 * dom/UIEvent.cpp: 34 (WebCore::UIEvent::UIEvent): 35 * dom/UIEvent.h: 36 (WebCore::UIEvent::create): Deleted. 37 * dom/UIEventInit.h: Added. 38 (WebCore::UIEventInit::UIEventInit): 39 * dom/UIEventInit.idl: Added. 40 * dom/UIEventWithKeyState.h: 41 (WebCore::UIEventWithKeyState::altGraphKey): 42 (WebCore::UIEventWithKeyState::capsLockKey): 43 (WebCore::UIEventWithKeyState::UIEventWithKeyState): 44 (WebCore::UIEventWithKeyState::ctrlKey): Deleted. 45 (WebCore::UIEventWithKeyState::shiftKey): Deleted. 46 (WebCore::UIEventWithKeyState::altKey): Deleted. 47 (WebCore::UIEventWithKeyState::metaKey): Deleted. 48 1 49 2016-10-09 Youenn Fablet <youenn@apple.com> 2 50 -
trunk/Source/WebCore/DerivedSources.cpp
r206963 r206971 191 191 #include "JSEvent.cpp" 192 192 #include "JSEventInit.cpp" 193 #include "JSEventModifierInit.cpp" 193 194 #include "JSEventSource.cpp" 194 195 #include "JSEventTarget.cpp" … … 631 632 #include "JSTreeWalker.cpp" 632 633 #include "JSUIEvent.cpp" 634 #include "JSUIEventInit.cpp" 633 635 #include "JSUIRequestEvent.cpp" 634 636 #include "JSURLUtils.cpp" -
trunk/Source/WebCore/DerivedSources.make
r206963 r206971 311 311 $(WebCore)/dom/EventInit.idl \ 312 312 $(WebCore)/dom/EventListener.idl \ 313 $(WebCore)/dom/EventModifierInit.idl \ 313 314 $(WebCore)/dom/EventTarget.idl \ 314 315 $(WebCore)/dom/FocusEvent.idl \ … … 349 350 $(WebCore)/dom/TreeWalker.idl \ 350 351 $(WebCore)/dom/UIEvent.idl \ 352 $(WebCore)/dom/UIEventInit.idl \ 351 353 $(WebCore)/dom/WebKitAnimationEvent.idl \ 352 354 $(WebCore)/dom/WebKitNamedFlow.idl \ -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r206963 r206971 2932 2932 83E359A31BB1031D002CEB98 /* JSHTMLTimeElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83E359A11BB1031D002CEB98 /* JSHTMLTimeElement.cpp */; }; 2933 2933 83F1206B1B8C104700D75F63 /* JSNodeFilterCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83F1206A1B8C103600D75F63 /* JSNodeFilterCustom.cpp */; }; 2934 83FE7CA71DA9F1A70037237C /* UIEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FE7CA41DA9F1660037237C /* UIEventInit.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2935 83FE7CA81DA9F1B60037237C /* EventModifierInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FE7CA31DA9F1650037237C /* EventModifierInit.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2934 2936 8419D2A7120D92D000141F8F /* SVGPathByteStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 8419D2A4120D92D000141F8F /* SVGPathByteStream.h */; }; 2935 2937 8419D2A8120D92D000141F8F /* SVGPathByteStreamBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8419D2A5120D92D000141F8F /* SVGPathByteStreamBuilder.cpp */; }; … … 10066 10068 83D35AEF1C718D8400F70D5A /* JSXMLHttpRequestEventTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLHttpRequestEventTarget.cpp; sourceTree = "<group>"; }; 10067 10069 83D35AF01C718D8400F70D5A /* JSXMLHttpRequestEventTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSXMLHttpRequestEventTarget.h; sourceTree = "<group>"; }; 10070 83E045EC1DAA104F00B0D8B9 /* JSEventModifierInit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventModifierInit.cpp; sourceTree = "<group>"; }; 10071 83E045ED1DAA104F00B0D8B9 /* JSEventModifierInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEventModifierInit.h; sourceTree = "<group>"; }; 10072 83E045EE1DAA104F00B0D8B9 /* JSUIEventInit.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSUIEventInit.cpp; sourceTree = "<group>"; }; 10073 83E045EF1DAA104F00B0D8B9 /* JSUIEventInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSUIEventInit.h; sourceTree = "<group>"; }; 10068 10074 83E359A01BB1031D002CEB98 /* JSHTMLTimeElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLTimeElement.h; sourceTree = "<group>"; }; 10069 10075 83E359A11BB1031D002CEB98 /* JSHTMLTimeElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLTimeElement.cpp; sourceTree = "<group>"; }; … … 10074 10080 83F570AD1C53268E007FD6CB /* JSXMLDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSXMLDocument.h; sourceTree = "<group>"; }; 10075 10081 83F570AE1C53268E007FD6CB /* JSXMLDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSXMLDocument.cpp; sourceTree = "<group>"; }; 10082 83FE7CA31DA9F1650037237C /* EventModifierInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventModifierInit.h; sourceTree = "<group>"; }; 10083 83FE7CA41DA9F1660037237C /* UIEventInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIEventInit.h; sourceTree = "<group>"; }; 10084 83FE7CA51DA9F1660037237C /* UIEventInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = UIEventInit.idl; sourceTree = "<group>"; }; 10085 83FE7CA61DA9F1660037237C /* EventModifierInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EventModifierInit.idl; sourceTree = "<group>"; }; 10076 10086 8419D2A4120D92D000141F8F /* SVGPathByteStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathByteStream.h; sourceTree = "<group>"; }; 10077 10087 8419D2A5120D92D000141F8F /* SVGPathByteStreamBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathByteStreamBuilder.cpp; sourceTree = "<group>"; }; … … 19700 19710 836D032B1DA8A13200FFD96B /* JSEventInit.cpp */, 19701 19711 836D032C1DA8A13200FFD96B /* JSEventInit.h */, 19712 83E045EC1DAA104F00B0D8B9 /* JSEventModifierInit.cpp */, 19713 83E045ED1DAA104F00B0D8B9 /* JSEventModifierInit.h */, 19702 19714 C6A703325C9D0B6CDCBC4D78 /* JSEventTarget.cpp */, 19703 19715 5FC7DC26CFE2563200B85AE5 /* JSEventTarget.h */, … … 19742 19754 A86629CA09DA2B47009633A5 /* JSUIEvent.cpp */, 19743 19755 A86629C909DA2B47009633A5 /* JSUIEvent.h */, 19756 83E045EE1DAA104F00B0D8B9 /* JSUIEventInit.cpp */, 19757 83E045EF1DAA104F00B0D8B9 /* JSUIEventInit.h */, 19744 19758 31C0FF390E4CEFAC007D6FE5 /* JSWebKitAnimationEvent.cpp */, 19745 19759 31C0FF3A0E4CEFAC007D6FE5 /* JSWebKitAnimationEvent.h */, … … 23125 23139 AD4495F1141FC08900541EDF /* EventListenerMap.cpp */, 23126 23140 AD4495F2141FC08900541EDF /* EventListenerMap.h */, 23141 83FE7CA31DA9F1650037237C /* EventModifierInit.h */, 23142 83FE7CA61DA9F1660037237C /* EventModifierInit.idl */, 23127 23143 939885C108B7E3D100E707C4 /* EventNames.cpp */, 23128 23144 939885C208B7E3D100E707C4 /* EventNames.h */, … … 23351 23367 85031B380A44EFC700F992E0 /* UIEvent.h */, 23352 23368 141B94EE09EC425A000E9413 /* UIEvent.idl */, 23369 83FE7CA41DA9F1660037237C /* UIEventInit.h */, 23370 83FE7CA51DA9F1660037237C /* UIEventInit.idl */, 23353 23371 93354A3B0B24F8C9003F6DEA /* UIEventWithKeyState.cpp */, 23354 23372 85031B390A44EFC700F992E0 /* UIEventWithKeyState.h */, … … 24209 24227 9DAC7C551AF2CAA200437C44 /* CSSContentDistributionValue.h in Headers */, 24210 24228 2D8FEBDD143E3EF70072502B /* CSSCrossfadeValue.h in Headers */, 24229 83FE7CA71DA9F1A70037237C /* UIEventInit.h in Headers */, 24211 24230 AA21ECCD0ABF0FC6002B834C /* CSSCursorImageValue.h in Headers */, 24212 24231 BC779E141BB215BB00CAA8BF /* CSSCustomPropertyValue.h in Headers */, … … 24367 24386 267725FF1A5B3AD9003C24DD /* DFANode.h in Headers */, 24368 24387 CD19A2681A13E700008D650E /* DiagnosticLoggingClient.h in Headers */, 24388 83FE7CA81DA9F1B60037237C /* EventModifierInit.h in Headers */, 24369 24389 46FCB6181A70820E00C5A21E /* DiagnosticLoggingKeys.h in Headers */, 24370 24390 8372DB311A6780A800C697C5 /* DiagnosticLoggingResultType.h in Headers */, -
trunk/Source/WebCore/dom/KeyboardEvent.cpp
r206828 r206971 96 96 97 97 KeyboardEvent::KeyboardEvent(const PlatformKeyboardEvent& key, DOMWindow* view) 98 : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()), 99 true, true, key.timestamp(), view, 0, key.ctrlKey(), key.altKey(), key.shiftKey(), key.metaKey()) 98 : UIEventWithKeyState(eventTypeForKeyboardEventType(key.type()) 99 , true, true, key.timestamp(), view, 0, key.ctrlKey(), key.altKey(), key.shiftKey() 100 , key.metaKey(), false, key.modifiers().contains(PlatformEvent::Modifier::CapsLockKey)) 100 101 , m_keyEvent(std::make_unique<PlatformKeyboardEvent>(key)) 101 102 #if ENABLE(KEYBOARD_KEY_ATTRIBUTE) … … 108 109 , m_location(keyLocationCode(key)) 109 110 , m_repeat(key.isAutoRepeat()) 110 , m_altGraphKey(false)111 , m_capsLockKey(key.modifiers().contains(PlatformEvent::Modifier::CapsLockKey))112 111 , m_isComposing(view && view->frame() && view->frame()->editor().hasComposition()) 113 112 #if PLATFORM(COCOA) … … 128 127 } 129 128 130 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const KeyboardEventInit& initializer)131 : UIEventWithKeyState(eventType, initializer )129 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const Init& initializer, IsTrusted isTrusted) 130 : UIEventWithKeyState(eventType, initializer, isTrusted) 132 131 #if ENABLE(KEYBOARD_KEY_ATTRIBUTE) 133 132 , m_key(initializer.key) … … 139 138 , m_location(initializer.location) 140 139 , m_repeat(initializer.repeat) 141 , m_altGraphKey(false) // FIXME: should be initialized from initializer.modifierAltGraph.142 , m_capsLockKey(false) // FIXME: should be initialized from initializer.modifierCapsLock.143 140 , m_isComposing(initializer.isComposing) 144 141 #if PLATFORM(COCOA) … … 183 180 return altGraphKey(); 184 181 if (keyIdentifier == "CapsLock") 185 return m_capsLockKey;182 return capsLockKey(); 186 183 // FIXME: The specification also has Fn, FnLock, Hyper, NumLock, Super, ScrollLock, Symbol, SymbolLock. 187 184 return false; -
trunk/Source/WebCore/dom/KeyboardEvent.h
r206828 r206971 24 24 #pragma once 25 25 26 #include "EventModifierInit.h" 26 27 #include "KeypressCommand.h" 27 28 #include "UIEventWithKeyState.h" … … 33 34 class Node; 34 35 class PlatformKeyboardEvent; 35 36 struct KeyboardEventInit : public UIEventWithKeyStateInit {37 #if ENABLE(KEYBOARD_KEY_ATTRIBUTE)38 String key;39 #endif40 #if ENABLE(KEYBOARD_CODE_ATTRIBUTE)41 String code;42 #endif43 String keyIdentifier;44 unsigned location { 0 };45 bool repeat { false };46 bool isComposing { false };47 };48 36 49 37 class KeyboardEvent final : public UIEventWithKeyState { … … 66 54 } 67 55 68 static Ref<KeyboardEvent> createForBindings(const AtomicString& type, const KeyboardEventInit& initializer) 56 struct Init : public EventModifierInit { 57 Init(bool bubbles, bool cancelable, bool composed, RefPtr<DOMWindow>&& view, int detail, 58 bool ctrlKey, bool shiftKey, bool altKey, bool metaKey, bool modifierAltGraph, bool modifierCapsLock, 59 String key, String code, Optional<unsigned> location, bool repeat, bool isComposing, String keyIdentifier, 60 Optional<unsigned> keyLocation) 61 : EventModifierInit(bubbles, cancelable, composed, WTFMove(view), detail, ctrlKey, shiftKey, altKey, metaKey, modifierAltGraph, modifierCapsLock) 62 , key(key) 63 , code(code) 64 , location(location ? *location : keyLocation.valueOr(DOM_KEY_LOCATION_STANDARD)) 65 , repeat(repeat) 66 , isComposing(isComposing) 67 , keyIdentifier(keyIdentifier) 68 { } 69 70 String key; 71 String code; 72 unsigned location; 73 bool repeat; 74 bool isComposing; 75 76 // Legacy. 77 String keyIdentifier; 78 }; 79 80 static Ref<KeyboardEvent> create(const AtomicString& type, const Init& initializer, IsTrusted isTrusted = IsTrusted::No) 69 81 { 70 return adoptRef(*new KeyboardEvent(type, initializer ));82 return adoptRef(*new KeyboardEvent(type, initializer, isTrusted)); 71 83 } 72 84 … … 96 108 97 109 WEBCORE_EXPORT bool getModifierState(const String& keyIdentifier) const; 98 99 bool altGraphKey() const { return m_altGraphKey; }100 110 101 111 const PlatformKeyboardEvent* keyEvent() const { return m_keyEvent.get(); } … … 121 131 WEBCORE_EXPORT KeyboardEvent(); 122 132 WEBCORE_EXPORT KeyboardEvent(const PlatformKeyboardEvent&, DOMWindow*); 123 KeyboardEvent(const AtomicString&, const KeyboardEventInit&);133 KeyboardEvent(const AtomicString&, const Init&, IsTrusted); 124 134 // FIXME: This method should be get rid of in the future. 125 135 // DO NOT USE IT! … … 136 146 unsigned m_location { DOM_KEY_LOCATION_STANDARD }; 137 147 bool m_repeat { false }; 138 bool m_altGraphKey { false };139 bool m_capsLockKey { false };140 148 bool m_isComposing { false }; 141 149 -
trunk/Source/WebCore/dom/KeyboardEvent.idl
r206803 r206971 20 20 21 21 [ 22 ConstructorConditional=DOM4_EVENTS_CONSTRUCTOR, 23 ConstructorTemplate=Event, 22 Constructor(DOMString type, optional KeyboardEventInit eventInitDict), 24 23 ] interface KeyboardEvent : UIEvent { 25 24 … … 29 28 const unsigned long DOM_KEY_LOCATION_NUMPAD = 0x03; 30 29 31 [ InitializedByEventConstructor,Conditional=KEYBOARD_KEY_ATTRIBUTE] readonly attribute DOMString key;32 [ InitializedByEventConstructor,Conditional=KEYBOARD_CODE_ATTRIBUTE] readonly attribute DOMString code;33 [InitializedByEventConstructor]readonly attribute unsigned long location;30 [Conditional=KEYBOARD_KEY_ATTRIBUTE] readonly attribute DOMString key; 31 [Conditional=KEYBOARD_CODE_ATTRIBUTE] readonly attribute DOMString code; 32 readonly attribute unsigned long location; 34 33 35 [InitializedByEventConstructor]readonly attribute boolean ctrlKey;36 [InitializedByEventConstructor]readonly attribute boolean shiftKey;37 [InitializedByEventConstructor]readonly attribute boolean altKey;38 [InitializedByEventConstructor]readonly attribute boolean metaKey;39 [InitializedByEventConstructor]readonly attribute boolean repeat;34 readonly attribute boolean ctrlKey; 35 readonly attribute boolean shiftKey; 36 readonly attribute boolean altKey; 37 readonly attribute boolean metaKey; 38 readonly attribute boolean repeat; 40 39 41 [InitializedByEventConstructor]readonly attribute boolean isComposing;40 readonly attribute boolean isComposing; 42 41 43 42 boolean getModifierState(DOMString keyArg); 44 43 45 44 // Everything below is legacy. 46 [InitializedByEventConstructor]readonly attribute DOMString keyIdentifier;47 [I nitializedByEventConstructor, ImplementedAs=location] readonly attribute unsigned long keyLocation;45 readonly attribute DOMString keyIdentifier; 46 [ImplementedAs=location] readonly attribute unsigned long keyLocation; 48 47 readonly attribute boolean altGraphKey; 49 48 … … 54 53 optional boolean ctrlKey = false, optional boolean altKey = false, optional boolean shiftKey = false, optional boolean metaKey = false, optional boolean altGraphKey = false); 55 54 }; 55 56 dictionary KeyboardEventInit : EventModifierInit { 57 DOMString key = ""; 58 DOMString code = ""; 59 unsigned long location; 60 boolean repeat = false; 61 boolean isComposing = false; 62 63 // This members are not in the specification but are needed to initialize the corresponding legacy 64 // attributes we still support on KeyboardEvent for backward compatibility. 65 DOMString keyIdentifier = ""; 66 unsigned long keyLocation; 67 }; -
trunk/Source/WebCore/dom/MouseRelatedEvent.cpp
r204681 r206971 62 62 #endif 63 63 bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool isSimulated) 64 : UIEventWithKeyState(eventType, canBubble, cancelable, timestamp, DOMWindow, detail, ctrlKey, altKey, shiftKey, metaKey )64 : UIEventWithKeyState(eventType, canBubble, cancelable, timestamp, DOMWindow, detail, ctrlKey, altKey, shiftKey, metaKey, false, false) 65 65 , m_screenLocation(screenLocation) 66 66 #if ENABLE(POINTER_LOCK) -
trunk/Source/WebCore/dom/MouseRelatedEvent.h
r204717 r206971 29 29 namespace WebCore { 30 30 31 struct MouseRelatedEventInit : public UIEventWithKeyStateInit {31 struct MouseRelatedEventInit : public EventModifierInit { 32 32 int screenX { 0 }; 33 33 int screenY { 0 }; -
trunk/Source/WebCore/dom/UIEvent.cpp
r204681 r206971 47 47 } 48 48 49 UIEvent::UIEvent(const AtomicString& eventType, const UIEventInit& initializer )50 : Event(eventType, initializer )49 UIEvent::UIEvent(const AtomicString& eventType, const UIEventInit& initializer, IsTrusted isTrusted) 50 : Event(eventType, initializer, isTrusted) 51 51 , m_view(initializer.view.get()) 52 52 , m_detail(initializer.detail) -
trunk/Source/WebCore/dom/UIEvent.h
r204717 r206971 26 26 #include "DOMWindow.h" 27 27 #include "Event.h" 28 #include "UIEventInit.h" 28 29 29 30 namespace WebCore { … … 31 32 // FIXME: Remove this when no one is depending on it anymore. 32 33 typedef DOMWindow AbstractView; 33 34 struct UIEventInit : public EventInit {35 RefPtr<DOMWindow> view;36 int detail { 0 };37 };38 34 39 35 class UIEvent : public Event { … … 75 71 UIEvent(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, int detail); 76 72 UIEvent(const AtomicString& type, bool canBubble, bool cancelable, double timestamp, DOMWindow*, int detail); 77 UIEvent(const AtomicString&, const UIEventInit& );73 UIEvent(const AtomicString&, const UIEventInit&, IsTrusted = IsTrusted::No); 78 74 79 75 private: -
trunk/Source/WebCore/dom/UIEventWithKeyState.h
r204681 r206971 25 25 #define UIEventWithKeyState_h 26 26 27 #include "EventModifierInit.h" 27 28 #include "UIEvent.h" 28 29 29 30 namespace WebCore { 30 31 struct UIEventWithKeyStateInit : public UIEventInit {32 bool ctrlKey { false };33 bool altKey { false };34 bool shiftKey { false };35 bool metaKey { false };36 };37 31 38 32 class UIEventWithKeyState : public UIEvent { … … 42 36 bool altKey() const { return m_altKey; } 43 37 bool metaKey() const { return m_metaKey; } 38 bool altGraphKey() const { return m_altGraphKey; } 39 bool capsLockKey() const { return m_capsLockKey; } 44 40 45 41 protected: 46 UIEventWithKeyState() 47 : m_ctrlKey(false) 48 , m_altKey(false) 49 , m_shiftKey(false) 50 , m_metaKey(false) 51 { 52 } 42 UIEventWithKeyState() = default; 53 43 54 44 UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, int detail, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) … … 61 51 } 62 52 63 UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, double timestamp, DOMWindow* view, int detail, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey) 64 : UIEvent(type, canBubble, cancelable, timestamp, view, detail) 65 , m_ctrlKey(ctrlKey) 66 , m_altKey(altKey) 67 , m_shiftKey(shiftKey) 68 , m_metaKey(metaKey) 53 UIEventWithKeyState(const AtomicString& type, bool canBubble, bool cancelable, double timestamp, DOMWindow* view, 54 int detail, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool altGraphKey, bool capsLockKey) 55 : UIEvent(type, canBubble, cancelable, timestamp, view, detail) 56 , m_ctrlKey(ctrlKey) 57 , m_altKey(altKey) 58 , m_shiftKey(shiftKey) 59 , m_metaKey(metaKey) 60 , m_altGraphKey(altGraphKey) 61 , m_capsLockKey(capsLockKey) 69 62 { 70 63 } 71 64 72 UIEventWithKeyState(const AtomicString& type, const UIEventWithKeyStateInit& initializer)73 : UIEvent(type, initializer )65 UIEventWithKeyState(const AtomicString& type, const EventModifierInit& initializer, IsTrusted isTrusted = IsTrusted::No) 66 : UIEvent(type, initializer, isTrusted) 74 67 , m_ctrlKey(initializer.ctrlKey) 75 68 , m_altKey(initializer.altKey) 76 69 , m_shiftKey(initializer.shiftKey) 77 70 , m_metaKey(initializer.metaKey) 71 , m_altGraphKey(initializer.modifierAltGraph) 72 , m_capsLockKey(initializer.modifierCapsLock) 78 73 { 79 74 } 80 75 81 76 // Expose these so init functions can set them. 82 bool m_ctrlKey : 1; 83 bool m_altKey : 1; 84 bool m_shiftKey : 1; 85 bool m_metaKey : 1; 77 bool m_ctrlKey { false }; 78 bool m_altKey { false }; 79 bool m_shiftKey { false }; 80 bool m_metaKey { false }; 81 bool m_altGraphKey { false }; 82 bool m_capsLockKey { false }; 86 83 }; 87 84
Note: See TracChangeset
for help on using the changeset viewer.