WebKit Bugzilla
Attachment 347974 Details for
Bug 188909
: initKeyboardEvent doesn't clear CapsLock state
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fixes the bug
bug-188909-20180823170246.patch (text/plain), 7.12 KB, created by
Ryosuke Niwa
on 2018-08-23 17:02:47 PDT
(
hide
)
Description:
Fixes the bug
Filename:
MIME Type:
Creator:
Ryosuke Niwa
Created:
2018-08-23 17:02:47 PDT
Size:
7.12 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 235262) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,18 @@ >+2018-08-23 Ryosuke Niwa <rniwa@webkit.org> >+ >+ initKeyboardEvent doesn't clear CapsLock state >+ https://bugs.webkit.org/show_bug.cgi?id=188909 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Fixed the bug by not preserving CapsLock state in setModifierKeys variant which takes boolean >+ for altGraphKey, which is only called by KeyboardEvent::initKeyboardEvent. >+ >+ Test: fast/events/init-event-clears-capslock.html >+ >+ * dom/UIEventWithKeyState.h: >+ (WebCore::UIEventWithKeyState::setModifierKeys): >+ > 2018-08-23 Saam barati <sbarati@apple.com> > > JSRunLoopTimer may run part of a member function after it's destroyed >Index: Source/WebCore/dom/UIEventWithKeyState.h >=================================================================== >--- Source/WebCore/dom/UIEventWithKeyState.h (revision 235248) >+++ Source/WebCore/dom/UIEventWithKeyState.h (working copy) >@@ -76,9 +76,6 @@ protected: > result |= Modifier::MetaKey; > if (altGraphKey) > result |= Modifier::AltGraphKey; >- // FIXME: Chrome or Firefox don't preserve this state. >- if (m_modifiers & Modifier::CapsLockKey) >- result |= Modifier::CapsLockKey; > m_modifiers = result; > } > >Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 235248) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,16 @@ >+2018-08-23 Ryosuke Niwa <rniwa@webkit.org> >+ >+ initKeyboardEvent doesn't clear CapsLock state >+ https://bugs.webkit.org/show_bug.cgi?id=188909 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added a regression test. Note that altGraph is only supported in WebKit >+ so Chrome and Firefox would fail to reset it via initKeyboardEvent. >+ >+ * fast/events/init-event-clears-capslock-expected.txt: Added. >+ * fast/events/init-event-clears-capslock.html: Added. >+ > 2018-08-23 Devin Rousso <drousso@apple.com> > > Web Inspector: support breakpoints for timers and animation-frame events >Index: LayoutTests/fast/events/init-event-clears-capslock-expected.txt >=================================================================== >--- LayoutTests/fast/events/init-event-clears-capslock-expected.txt (nonexistent) >+++ LayoutTests/fast/events/init-event-clears-capslock-expected.txt (working copy) >@@ -0,0 +1,43 @@ >+This tests invoking initKeyboardEvent after setting CapsLock state to true via KeyboardEvent's constructor. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+keyEvent = new KeyboardEvent('keydown', { bubbles: true, cancelable: true, view: window, detail: 0, key: 'a', code: 'KeyA', >+ ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, modifierAltGraph: true, modifierCapsLock: true }); >+PASS keyEvent.ctrlKey is true >+PASS keyEvent.shiftKey is true >+PASS keyEvent.altKey is true >+PASS keyEvent.metaKey is true >+PASS keyEvent.getModifierState("Control") is true >+PASS keyEvent.getModifierState("Shift") is true >+PASS keyEvent.getModifierState("Alt") is true >+PASS keyEvent.getModifierState("Meta") is true >+PASS keyEvent.getModifierState("AltGraph") is true >+PASS keyEvent.getModifierState("CapsLock") is true >+keyEvent.initKeyboardEvent('keydown', false, false, window, 'U+0041', 0, /* ctrl */ false, /* alt */ false, /* shift */ false, /* meta */ false, /* altGraph */ false) >+PASS keyEvent.ctrlKey is false >+PASS keyEvent.shiftKey is false >+PASS keyEvent.altKey is false >+PASS keyEvent.metaKey is false >+PASS keyEvent.getModifierState("Control") is false >+PASS keyEvent.getModifierState("Shift") is false >+PASS keyEvent.getModifierState("Alt") is false >+PASS keyEvent.getModifierState("Meta") is false >+PASS keyEvent.getModifierState("AltGraph") is false >+PASS keyEvent.getModifierState("CapsLock") is false >+keyEvent.initKeyboardEvent('keydown', false, false, window, 'U+0041', 0, /* ctrl */ true, /* alt */ true, /* shift */ true, /* meta */ true, /* altGraph */ true) >+PASS keyEvent.ctrlKey is true >+PASS keyEvent.shiftKey is true >+PASS keyEvent.altKey is true >+PASS keyEvent.metaKey is true >+PASS keyEvent.getModifierState("Control") is true >+PASS keyEvent.getModifierState("Shift") is true >+PASS keyEvent.getModifierState("Alt") is true >+PASS keyEvent.getModifierState("Meta") is true >+PASS keyEvent.getModifierState("AltGraph") is true >+PASS keyEvent.getModifierState("CapsLock") is false >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >Index: LayoutTests/fast/events/init-event-clears-capslock.html >=================================================================== >--- LayoutTests/fast/events/init-event-clears-capslock.html (nonexistent) >+++ LayoutTests/fast/events/init-event-clears-capslock.html (working copy) >@@ -0,0 +1,48 @@ >+<!DOCTYPE html> >+<html> >+<body> >+<script src="../../resources/js-test.js"></script> >+<script> >+ >+description(`This tests invoking initKeyboardEvent after setting CapsLock state to true via KeyboardEvent's constructor.`); >+ >+evalAndLog(`keyEvent = new KeyboardEvent('keydown', { bubbles: true, cancelable: true, view: window, detail: 0, key: 'a', code: 'KeyA', >+ ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, modifierAltGraph: true, modifierCapsLock: true });`); >+shouldBeTrue('keyEvent.ctrlKey'); >+shouldBeTrue('keyEvent.shiftKey'); >+shouldBeTrue('keyEvent.altKey'); >+shouldBeTrue('keyEvent.metaKey'); >+shouldBeTrue('keyEvent.getModifierState("Control")'); >+shouldBeTrue('keyEvent.getModifierState("Shift")'); >+shouldBeTrue('keyEvent.getModifierState("Alt")'); >+shouldBeTrue('keyEvent.getModifierState("Meta")'); >+shouldBeTrue('keyEvent.getModifierState("AltGraph")'); >+shouldBeTrue('keyEvent.getModifierState("CapsLock")'); >+ >+evalAndLog(`keyEvent.initKeyboardEvent('keydown', false, false, window, 'U+0041', 0, /* ctrl */ false, /* alt */ false, /* shift */ false, /* meta */ false, /* altGraph */ false)`); >+shouldBeFalse('keyEvent.ctrlKey'); >+shouldBeFalse('keyEvent.shiftKey'); >+shouldBeFalse('keyEvent.altKey'); >+shouldBeFalse('keyEvent.metaKey'); >+shouldBeFalse('keyEvent.getModifierState("Control")'); >+shouldBeFalse('keyEvent.getModifierState("Shift")'); >+shouldBeFalse('keyEvent.getModifierState("Alt")'); >+shouldBeFalse('keyEvent.getModifierState("Meta")'); >+shouldBeFalse('keyEvent.getModifierState("AltGraph")'); >+shouldBeFalse('keyEvent.getModifierState("CapsLock")'); >+ >+evalAndLog(`keyEvent.initKeyboardEvent('keydown', false, false, window, 'U+0041', 0, /* ctrl */ true, /* alt */ true, /* shift */ true, /* meta */ true, /* altGraph */ true)`); >+shouldBeTrue('keyEvent.ctrlKey'); >+shouldBeTrue('keyEvent.shiftKey'); >+shouldBeTrue('keyEvent.altKey'); >+shouldBeTrue('keyEvent.metaKey'); >+shouldBeTrue('keyEvent.getModifierState("Control")'); >+shouldBeTrue('keyEvent.getModifierState("Shift")'); >+shouldBeTrue('keyEvent.getModifierState("Alt")'); >+shouldBeTrue('keyEvent.getModifierState("Meta")'); >+shouldBeTrue('keyEvent.getModifierState("AltGraph")'); >+shouldBeFalse('keyEvent.getModifierState("CapsLock")'); >+ >+</script> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188909
: 347974