Bug 1504911 - part 3: Make TextEditRules::WillSetText() not handle anything when EditAction is eReplaceText r=m_kato
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 20 Nov 2018 14:34:32 +0000
changeset 503893 7f09364736a089ada819bd73b5e7e28a4f048b3b
parent 503892 110224ca92565e84894ce093dea626a62f599057
child 503894 09fd7845a50bad9fa7a579a9e7088828d8155a20
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1504911
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1504911 - part 3: Make TextEditRules::WillSetText() not handle anything when EditAction is eReplaceText r=m_kato 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(). Differential Revision: https://phabricator.services.mozilla.com/D12246
dom/html/test/forms/test_MozEditableElement_setUserInput.html
editor/libeditor/TextEditRules.cpp
--- a/dom/html/test/forms/test_MozEditableElement_setUserInput.html
+++ b/dom/html/test/forms/test_MozEditableElement_setUserInput.html
@@ -202,19 +202,16 @@ SimpleTest.waitForFocus(() => {
           test.type === "reset" ||
           test.type === "button") {
         todo_is(inputEvents.length, 0,
                 `No "input" event should be dispatched when setUserInput("${test.input.after}") is called after ${tag} gets focus`);
       } else {
         is(inputEvents.length, 0,
            `No "input" event should be dispatched when setUserInput("${test.input.after}") is called after ${tag} gets focus`);
       }
-    } else if (test.type === "password") {
-      is(inputEvents.length, 0,
-         `Only one "input" event should be dispatched when setUserInput("${test.input.after}") is called after ${tag} gets focus`);
     } else {
       is(inputEvents.length, 1,
          `Only one "input" event should be dispatched when setUserInput("${test.input.after}") is called after ${tag} gets focus`);
     }
     if (inputEvents.length > 0) {
       if (test.result.useInputEvent) {
         if (test.type === "number" || test.type === "time") {
           todo(inputEvents[0] instanceof InputEvent,
--- a/editor/libeditor/TextEditRules.cpp
+++ b/editor/libeditor/TextEditRules.cpp
@@ -951,16 +951,17 @@ TextEditRules::WillSetText(bool* aCancel
   CANCEL_OPERATION_IF_READONLY_OR_DISABLED
 
   *aHandled = false;
   *aCancel = false;
 
   if (!IsPlaintextEditor() ||
       TextEditorRef().IsIMEComposing() ||
       TextEditorRef().IsUndoRedoEnabled() ||
+      TextEditorRef().GetEditAction() == EditAction::eReplaceText ||
       aMaxLength != -1) {
     // SetTextImpl only supports plain text editor without IME and
     // when we don't need to make it undoable.
     return NS_OK;
   }
 
   if (IsPasswordEditor() && !DontEchoPassword()) {
     // Echo password timer will implement on InsertText.