Closed
Bug 1504911
Opened 6 years ago
Closed 6 years ago
HTMLInputELement::SetUserInput() shouldn't dispatch "input" element by itself if has editor
Categories
(Core :: DOM: Events, enhancement, P2)
Core
DOM: Events
Tracking
()
RESOLVED
FIXED
mozilla65
Tracking | Status | |
---|---|---|
firefox65 | --- | fixed |
People
(Reporter: masayuki, Assigned: masayuki)
References
Details
Attachments
(6 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
Details | Review |
HTMLInputELement::SetUserInput() dispatches "input" event by itself. However, the event class won't be InputEvent and its inputType won't be initialized by editor. So, when HTMLInputElement has editor, editor should dispatch "input" event and HTMLInputElement should do nothing.
Updated•6 years ago
|
Priority: -- → P2
Assignee | ||
Comment 1•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=6d639fa5052d8d029f833052ded42ca8e226b826
Assignee | ||
Comment 2•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=bb4921d0e62d9035555e0fca0e23406442777af3
Assignee | ||
Comment 3•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=d78a59b8bd97f5a30527b40ceee0382b15856eaf
Assignee | ||
Comment 4•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=d75ab391b0cd9b73934a9a2360565377f99dc96b
Assignee | ||
Comment 5•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=62954aa53382e5b3eee3eab5d4ab9bec37186adf
Assignee | ||
Comment 6•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=9561ca2e5d77b08aac0fc6148f552d2141777c4e
Assignee | ||
Comment 7•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=ccff5665762cf595d9b524e91fd49c5d9cfb48f4
Assignee | ||
Comment 8•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=cc2ab5487f349f8cb422af6c48ffc6639fdc287d
Assignee | ||
Comment 9•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=7c36fd3e7610e20c3daf64e43fcc7d3b64c2ef76
Assignee | ||
Comment 10•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=36bc29c5035bde23d0a3471f440e7d6531505e10
Assignee | ||
Comment 11•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=72f1b827fc5f76a2faea3259288569ee031fbfc0
Assignee | ||
Comment 12•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=64d26264c80c4aabad0174ee2f40007c2fc18e66
Assignee | ||
Comment 13•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=852c51b8518e1b31bc14fd0d946bd4699aed383d
Assignee | ||
Comment 14•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=d524d8fd0d52596df71474c5115313207e622711
Assignee | ||
Comment 15•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=3feb2278ee7f1d3bd9d4328f3beb5669c579c60a
Assignee | ||
Comment 16•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=a5b1e80ebf89a5fdd7ae1c920b72257246e49897
Assignee | ||
Comment 17•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=ecba49aeb4687c580e21f120d7d20af82222f60f
Assignee | ||
Comment 18•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=cfc6a71f9ddde2e3ba03aa60e59242aa3d0f5fdc
Assignee | ||
Comment 19•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=cd61f0da50081b8d6edfba3e869aa74b52366fe7
Assignee | ||
Comment 20•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=970916833ee81d0bb0fa7cfc744bafabce8c6e6d
Assignee | ||
Comment 21•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=5fbdc686a2e151d06a2dbfd014f37f9082ec9427
Assignee | ||
Comment 22•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=6c20417ae49748459f5a10c4073f5c160504710d
Assignee | ||
Comment 23•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=1aed3b381730015daa47f94c1d63f9cbc696df1a
Assignee | ||
Comment 24•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=de9324809585ccff70e0b27792b15131da1847f7
Assignee | ||
Comment 25•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=67a4fcb330bc860f1c2e7f04cc9a67251504a939
Assignee | ||
Comment 26•6 years ago
|
||
It's difficult to create new test which checks "input" events caused by all edit operations especially when text is inserted from our UI. Therefore, this adds "input" event type checks into existing tests. Additionally, this adds new test for MozEditableElement.setUserInput() whose behavior needs to be fixed in this bug. Currently, InputEvent interface should be used only on text controls or contenteditable editor when dispatching "input" event. https://w3c.github.io/input-events/#events-inputevents You may feel odd to use different event interface for same "input" events. However, other browsers also use InputEvent interface only in the cases. So, we should follow them for now.
Assignee | ||
Comment 27•6 years ago
|
||
Currently, a lot of code dispatch "input" event and some of them dispatch "input" event with wrong interface and/or values. Therefore this patch creates nsContentUtils::DispatchInputEvent() to make all of them dispatch correct event. Unfortunately, due to bug 1506439, we cannot set pointer to refcountable classes of MOZ_CAN_RUN_SCRIPT method to nullptr. Therefore, this patch creates temporary RefPtr<TextEditor> a lot even though it makes damage to the performance if it's in a hot path.
Assignee | ||
Comment 28•6 years ago
|
||
When editor is modified as part of user action, aFlags of nsTextEditorState::SetValue() includes eSetValue_BySetUserInput. In this case, TextEditor (if there is) or the method itself (if there is no editor yet) should dispatch "input" event by themselves because we will need to initialize InputEvents more since we're going to implement Input Event specs. Note that even with this patch, password field stops dispatching "input" event with call of HTMLInputElement::SetUserInput(). This is caused by a hidden bug of TextEditRules. This will be fixed in a following patch.
Assignee | ||
Comment 29•6 years ago
|
||
When all editor text is replaced while handling a user operation, editor needs to dispatch "input" event. Therefore, in such case, i.e., EditAction is eReplaceText, TextEditor::SetTextAsSubAction() needs to handle it instead of TextEditRules::WillSetText().
Assignee | ||
Comment 30•6 years ago
|
||
Currently, some "input" event dispatchers in our script dispatch "input" event with UIEvent. This is completely wrong. For conforming to HTML spec, Event is proper event. Additionally, for conforming to Input Events, InputEvent is proper event only on <textarea> or <input> element which has a single line editor. For making us to maintain easier, this patch adds new API, "isInputEventTarget" to MozEditableElement which returns true when "input" event dispatcher should use InputEvent for the input element. Finally, this makes some dispatchers use setUserInput() instead of setting value and dispatching event by themselves. This also makes us to maintain them easier. Note that this does not touch "input" event dispatchers which dispatch events only for chrome (such as URL bar, some pages in about: scheme) for making this change safer as far as possible.
Assignee | ||
Comment 31•6 years ago
|
||
Currently, calling nsITableEditor.insertTableCell() does not cause dispatching "input" event since it does not create AutoPlaceholderBatch. Additionally, different from InsertTableRowsWithTransaction() and InsertTableColumnsWithTransaction(), it does not create AutoTopLevelEditSubActionNotifier. Because of those APIs should work similartly, we should make it creates both auto class instances.
Assignee | ||
Comment 32•6 years ago
|
||
Comment on attachment 9025998 [details] Bug 1504911 - part 4: Make all script for web content dispatch "input" event with proper event interface This patch touches mobile/android/modules/geckoview/GeckoViewAutoFill.jsm because of fixing its bug. However, according to the file path, this is a part of GeckoView. I don't know how to test this actually nor which automated test covers this code. So, I still don't test it yet. Additionally, it uses an internal API, MozEditableElement.setUserInput(), which is marked as IsChromeOrXBLOrUAWidget. https://searchfox.org/mozilla-central/rev/5117a4c4e29fcf80a627fecf899a62f117368abf/dom/webidl/HTMLInputElement.webidl#198-199 Could you let me know how to test it or an automated test which checks this behavior?
Flags: needinfo?(jimnchen+bmo)
Assignee | ||
Comment 33•6 years ago
|
||
Oh, sorry, I realized that I've already received your email! Thanks!
Flags: needinfo?(jimnchen+bmo)
Assignee | ||
Comment 34•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=55536aa3a0b34732254f23d17cb0e17909139e13
Assignee | ||
Comment 35•6 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (JST, +0900) from comment #32) > Comment on attachment 9025998 [details] > Bug 1504911 - part 4: Make all script for web content dispatch "input" event > with proper event interface > > This patch touches mobile/android/modules/geckoview/GeckoViewAutoFill.jsm > because of fixing its bug. However, according to the file path, this is a > part of GeckoView. I don't know how to test this actually nor which > automated test covers this code. So, I still don't test it yet. > Additionally, it uses an internal API, MozEditableElement.setUserInput(), > which is marked as IsChromeOrXBLOrUAWidget. > https://searchfox.org/mozilla-central/rev/ > 5117a4c4e29fcf80a627fecf899a62f117368abf/dom/webidl/HTMLInputElement. > webidl#198-199 Well, I added event interface check into AccessibilityTest.kt and ContentDelegateTest.kt, and build all builds for Android, and make all tests run: https://treeherder.mozilla.org/#/jobs?repo=try&selectedJob=212562803&revision=88b2c64c0da961b5701d489b406d7cc8c72286e1 Then, I don't see any errors. So, I assume that the change is correct.
Assignee | ||
Comment 36•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=09d189bc0cf8e2d58bd9502e9046b33e68771e07
Assignee | ||
Comment 37•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=1958f0befca0d204da83ae383c83457ce4fd36eb
Comment 38•6 years ago
|
||
Pushed by masayuki@d-toybox.com: https://hg.mozilla.org/integration/autoland/rev/d4a142e1648b part 0: Add "input" event tests into existing tests r=smaug https://hg.mozilla.org/integration/autoland/rev/48440593d675 part 1: Make all "input" event dispatcher in C++ use new utility method r=smaug https://hg.mozilla.org/integration/autoland/rev/110224ca9256 part 2: Make nsTextEditorState::SetValue() dispatch "input" event if it's called for handling part of user input r=smaug https://hg.mozilla.org/integration/autoland/rev/7f09364736a0 part 3: Make TextEditRules::WillSetText() not handle anything when EditAction is eReplaceText r=m_kato https://hg.mozilla.org/integration/autoland/rev/09fd7845a50b part 4: Make all script for web content dispatch "input" event with proper event interface r=smaug https://hg.mozilla.org/integration/autoland/rev/824bcd08c85e part 5: Make HTMLEditor::InsertTableCellsWithTransaction() create AutoPlaceholderBatch and AutoTopLevelEditSubActionNotifier r=m_kato
Comment 39•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/d4a142e1648b https://hg.mozilla.org/mozilla-central/rev/48440593d675 https://hg.mozilla.org/mozilla-central/rev/110224ca9256 https://hg.mozilla.org/mozilla-central/rev/7f09364736a0 https://hg.mozilla.org/mozilla-central/rev/09fd7845a50b https://hg.mozilla.org/mozilla-central/rev/824bcd08c85e
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
You need to log in
before you can comment on or make changes to this bug.
Description
•