RESOLVED FIXED 188913
Add getModifierState to MouseEvent
https://bugs.webkit.org/show_bug.cgi?id=188913
Summary Add getModifierState to MouseEvent
Ryosuke Niwa
Reported 2018-08-23 19:13:41 PDT
Right now, getModifierState only exists on KeyboardEvent but it's also supposed to be on MouseEvent.
Attachments
Adds the method (33.71 KB, patch)
2018-08-23 20:35 PDT, Ryosuke Niwa
no flags
Fixed iOS tests (37.29 KB, patch)
2018-08-23 22:21 PDT, Ryosuke Niwa
simon.fraser: review+
Radar WebKit Bug Importer
Comment 1 2018-08-23 19:13:58 PDT
Ryosuke Niwa
Comment 2 2018-08-23 20:35:18 PDT
Created attachment 347985 [details] Adds the method
Ryosuke Niwa
Comment 3 2018-08-23 22:21:42 PDT
Created attachment 347989 [details] Fixed iOS tests
Simon Fraser (smfr)
Comment 4 2018-08-24 10:33:43 PDT
Comment on attachment 347989 [details] Fixed iOS tests View in context: https://bugs.webkit.org/attachment.cgi?id=347989&action=review > Source/WebCore/ChangeLog:13 > + This patch also fixes the bug r235158 purposefully preserved that initMouseEvent was not clearing > + AltGraph and CapsLock states. This is not a readable sentence. > Source/WebCore/dom/UIEventWithKeyState.cpp:57 > + if (keyIdentifier == "Control") > + return ctrlKey(); > + if (keyIdentifier == "Shift") > + return shiftKey(); > + if (keyIdentifier == "Alt") > + return altKey(); > + if (keyIdentifier == "Meta") > + return metaKey(); > + if (keyIdentifier == "AltGraph") > + return altGraphKey(); > + if (keyIdentifier == "CapsLock") > + return capsLockKey(); Are these supposed to be case-sensitive comparisons? Can we use AtomicStrings here? Should the standard names be constants in the code? > LayoutTests/ChangeLog:10 > + Added two tests for getModifierState: one manually setting modifier key states in MouseEvent's constructor, > + and another one for dblclick inheriting modifier key states from the click event. Are there really no WPT tests for these?
Ryosuke Niwa
Comment 5 2018-08-24 13:04:33 PDT
(In reply to Simon Fraser (smfr) from comment #4) > Comment on attachment 347989 [details] > Fixed iOS tests > > View in context: > https://bugs.webkit.org/attachment.cgi?id=347989&action=review > > > Source/WebCore/ChangeLog:13 > > + This patch also fixes the bug r235158 purposefully preserved that initMouseEvent was not clearing > > + AltGraph and CapsLock states. > > This is not a readable sentence. Fixed per in-person discussion. > > Source/WebCore/dom/UIEventWithKeyState.cpp:57 > > + if (keyIdentifier == "Control") > > + return ctrlKey(); > > + if (keyIdentifier == "Shift") > > + return shiftKey(); > > + if (keyIdentifier == "Alt") > > + return altKey(); > > + if (keyIdentifier == "Meta") > > + return metaKey(); > > + if (keyIdentifier == "AltGraph") > > + return altGraphKey(); > > + if (keyIdentifier == "CapsLock") > > + return capsLockKey(); > > Are these supposed to be case-sensitive comparisons? Can we use > AtomicStrings here? Should the standard names be constants in the code? The spec doesn't specify but both Chrome & Firefox does case-sensitive comparison as we do. I don't think it makes senes to use AtomicString her since the input to getModifierState isn't necessarily AtomicString. > > LayoutTests/ChangeLog:10 > > + Added two tests for getModifierState: one manually setting modifier key states in MouseEvent's constructor, > > + and another one for dblclick inheriting modifier key states from the click event. > > Are there really no WPT tests for these? Unfortunately not. There are literally no getModifierState tests other than IDL and one test Microsoft added.
Ryosuke Niwa
Comment 6 2018-08-24 13:07:30 PDT
Filed https://github.com/w3c/uievents/issues/211 to the case sensitive comparison in the spec.
Ryosuke Niwa
Comment 7 2018-08-24 13:07:38 PDT
Lucas Forschler
Comment 8 2019-02-06 09:18:38 PST
Mass move bugs into the DOM component.
Note You need to log in before you can comment on or make changes to this bug.