diff --git a/LayoutTests/editing/execCommand/break-out-of-empty-list-item.html b/LayoutTests/editing/execCommand/break-out-of-empty-list-item.html index ca720207830df..babab38d3fbc2 100644 --- a/LayoutTests/editing/execCommand/break-out-of-empty-list-item.html +++ b/LayoutTests/editing/execCommand/break-out-of-empty-list-item.html @@ -11,20 +11,6 @@ testContainer.contentEditable = true; document.body.appendChild(testContainer); -function pressKey(key) -{ - if (window.KeyEvent) { - var ev = document.createEvent("KeyboardEvent"); - ev.initKeyEvent("keypress", true, true, window, 0,0,0,0, 0, key.charCodeAt(0)); - document.body.dispatchEvent(ev); - } - else { - var ev = document.createEvent("TextEvent"); - ev.initTextEvent('textInput', true, true, null, key.charAt(0)); - document.body.dispatchEvent(ev); - } -} - function enterAtTarget(initialContent) { testContainer.innerHTML = initialContent; @@ -39,8 +25,7 @@ s.removeAllRanges(); s.addRange(r); - pressKey('\n'); - + document.execCommand("InsertParagraph"); return testContainer.innerHTML; } diff --git a/LayoutTests/editing/inserting/typing-space-to-trigger-smart-link.html b/LayoutTests/editing/inserting/typing-space-to-trigger-smart-link.html index e9ae04dc2107f..b3c2037c6054a 100644 --- a/LayoutTests/editing/inserting/typing-space-to-trigger-smart-link.html +++ b/LayoutTests/editing/inserting/typing-space-to-trigger-smart-link.html @@ -12,7 +12,7 @@ var testTypeSpaceDiv = document.getElementById('testTypeSpace'); var targetText = testTypeSpaceDiv.firstChild; window.getSelection().setPosition(targetText, 15); - pressKey(" "); + document.execCommand("InsertText", false, " "); var expectedContents = "The www.foo.com should be underlined and there is an anchor node created for it."; if (expectedContents == testTypeSpaceDiv.innerHTML) document.getElementById('log').textContent = "PASS: the anchor for 'www.foo.com' has been created.\n" @@ -22,18 +22,18 @@ var testTypeLinkDiv = document.getElementById('testTypeLink'); targetText = testTypeLinkDiv.firstChild; window.getSelection().setPosition(targetText, 4); - pressKey("w"); - pressKey("w"); - pressKey("w"); - pressKey("."); - pressKey("b"); - pressKey("a"); - pressKey("r"); - pressKey("."); - pressKey("c"); - pressKey("o"); - pressKey("m"); - pressKey(" "); + document.execCommand("InsertText", false, "w"); + document.execCommand("InsertText", false, "w"); + document.execCommand("InsertText", false, "w"); + document.execCommand("InsertText", false, "."); + document.execCommand("InsertText", false, "b"); + document.execCommand("InsertText", false, "a"); + document.execCommand("InsertText", false, "r"); + document.execCommand("InsertText", false, "."); + document.execCommand("InsertText", false, "c"); + document.execCommand("InsertText", false, "o"); + document.execCommand("InsertText", false, "m"); + document.execCommand("InsertText", false, " "); expectedContents = "The www.bar.com should be underlined and there is an anchor node created for it."; if (expectedContents == testTypeLinkDiv.innerHTML) document.getElementById('log').textContent += "PASS: the anchor for 'www.bar.com' has been created." @@ -43,19 +43,6 @@ if (window.internals) internals.setAutomaticLinkDetectionEnabled(false); } - -function pressKey(key) -{ - if (window.KeyEvent) { - var ev = document.createEvent("KeyboardEvent"); - ev.initKeyEvent("keypress", true, true, window, 0,0,0,0, 0, key.charCodeAt(0)); - document.body.dispatchEvent(ev); - } else { - var ev = document.createEvent("TextEvent"); - ev.initTextEvent('textInput', true, true, null, key.charAt(0)); - document.body.dispatchEvent(ev); - } -}
diff --git a/LayoutTests/editing/pasteboard/paste-text-events-expected.txt b/LayoutTests/editing/pasteboard/paste-text-events-expected.txt index c81e8e202da92..39e3371132b4f 100644 --- a/LayoutTests/editing/pasteboard/paste-text-events-expected.txt +++ b/LayoutTests/editing/pasteboard/paste-text-events-expected.txt @@ -16,19 +16,6 @@ PASS testTargetInput.value is 'RichHello' PASS event.data is '' PASS testTargetEditable.innerHTML is 'RichHello' PASS textInputCount is proceedingTestCases.length -PASS event.data is 'PlainHello' -PASS testTargetTextarea.value is '' -PASS event.data is 'PlainHello' -PASS testTargetInput.value is '' -PASS event.data is '' -PASS testTargetEditable.innerHTML is '' -PASS event.data is 'RichHello' -PASS testTargetTextarea.value is '' -PASS event.data is 'RichHello' -PASS testTargetInput.value is '' -PASS event.data is '' -PASS testTargetEditable.innerHTML is '' -PASS textInputCount is cancelingTestCases.length PASS successfullyParsed is true TEST COMPLETE diff --git a/LayoutTests/editing/pasteboard/paste-text-events.html b/LayoutTests/editing/pasteboard/paste-text-events.html index b1b375db35af1..694013d344c13 100644 --- a/LayoutTests/editing/pasteboard/paste-text-events.html +++ b/LayoutTests/editing/pasteboard/paste-text-events.html @@ -22,8 +22,6 @@ { shouldBe("event.data", toStringLiteral(expectedTextEventData)); textInputCount++; - if (willCancelTextInput) - evt.preventDefault(); } var testSourceRoot = document.createElement("div"); @@ -112,15 +110,6 @@ [copyRichText, pasteToTargetEditable, targetEditableShouldHave, "RichHello", ""], ]; -var cancelingTestCases = [ - [copyPlainText, pasteToTargetTextarea, targetTextareaShouldHave, "", "PlainHello"], - [copyPlainText, pasteToTargetInput, targetInputShouldHave, "", "PlainHello"], - [copyPlainText, pasteToTargetEditable, targetEditableShouldHave, "", ""], - [copyRichText, pasteToTargetTextarea, targetTextareaShouldHave, "", "RichHello"], - [copyRichText, pasteToTargetInput, targetInputShouldHave, "", "RichHello"], - [copyRichText, pasteToTargetEditable, targetEditableShouldHave, "", ""], -]; - function runSingleTest(caseData) { var copy = caseData[0]; @@ -136,17 +125,10 @@ } textInputCount = 0; -willCancelTextInput = false; for (var i = 0; i < proceedingTestCases.length; ++i) runSingleTest(proceedingTestCases[i]); shouldBe("textInputCount", "proceedingTestCases.length"); -textInputCount = 0; -willCancelTextInput = true; -for (var i = 0; i < cancelingTestCases.length; ++i) - runSingleTest(cancelingTestCases[i]); -shouldBe("textInputCount", "cancelingTestCases.length"); - // Hides dataset to make dump clean. testTargetRoot.style.display = "none"; testSourceRoot.style.display = "none"; diff --git a/LayoutTests/editing/style/highlight-insert-paragraph.html b/LayoutTests/editing/style/highlight-insert-paragraph.html index e9c0ca01811b5..4174d9deb9e88 100644 --- a/LayoutTests/editing/style/highlight-insert-paragraph.html +++ b/LayoutTests/editing/style/highlight-insert-paragraph.html @@ -9,20 +9,6 @@ + + diff --git a/LayoutTests/fast/events/ios/submit-form-target-blank-using-return-key.html b/LayoutTests/fast/events/ios/submit-form-target-blank-using-return-key.html index 791992954f020..ea4cef6e8414d 100644 --- a/LayoutTests/fast/events/ios/submit-form-target-blank-using-return-key.html +++ b/LayoutTests/fast/events/ios/submit-form-target-blank-using-return-key.html @@ -28,6 +28,7 @@ function checkKeypressAndDone() { shouldBeEqualToString("event.key", "Enter"); + done(); } function runTest() diff --git a/LayoutTests/fast/events/onchange-passwordfield.html b/LayoutTests/fast/events/onchange-passwordfield.html index 2787f902ef0af..93ab08672a7b3 100644 --- a/LayoutTests/fast/events/onchange-passwordfield.html +++ b/LayoutTests/fast/events/onchange-passwordfield.html @@ -28,7 +28,11 @@ // hit enter input.focus(); -if (window.eventSender) - eventSender.keyDown("\r", []); +const enterKeyEvent = new KeyboardEvent('keypress', { bubbles: true, cancelable: true, view: window, detail: 0, + key: 'Enter', code: 'Enter', keyIdentifier: '', keyCode: 13, charCode: 13, which: 13, + location: 0, ctrlKey: false, altKey: false, shiftKey: false, metaKey: false }); +// We use dispatchEvent() here because if eventSender.keyDown() is used +// instead, this test will fail when run with the WPE port. +input.dispatchEvent(enterKeyEvent); diff --git a/LayoutTests/fast/events/onchange-searchfield.html b/LayoutTests/fast/events/onchange-searchfield.html index 44cab4d10959f..92129546dc914 100644 --- a/LayoutTests/fast/events/onchange-searchfield.html +++ b/LayoutTests/fast/events/onchange-searchfield.html @@ -28,7 +28,11 @@ // hit enter input.focus(); -if (window.eventSender) - eventSender.keyDown("\r", []); +const enterKeyEvent = new KeyboardEvent('keypress', { bubbles: true, cancelable: true, view: window, detail: 0, + key: 'Enter', code: 'Enter', keyIdentifier: '', keyCode: 13, charCode: 13, which: 13, + location: 0, ctrlKey: false, altKey: false, shiftKey: false, metaKey: false }); +// We use dispatchEvent() here because if eventSender.keyDown() is used +// instead, this test will fail when run with the WPE port. +input.dispatchEvent(enterKeyEvent); diff --git a/LayoutTests/fast/events/onchange-textfield.html b/LayoutTests/fast/events/onchange-textfield.html index 0f7ac20dcd313..88fc32f18b499 100644 --- a/LayoutTests/fast/events/onchange-textfield.html +++ b/LayoutTests/fast/events/onchange-textfield.html @@ -28,7 +28,11 @@ // hit enter input.focus(); -if (window.eventSender) - eventSender.keyDown("\r", []); +const enterKeyEvent = new KeyboardEvent('keypress', { bubbles: true, cancelable: true, view: window, detail: 0, + key: 'Enter', code: 'Enter', keyIdentifier: '', keyCode: 13, charCode: 13, which: 13, + location: 0, ctrlKey: false, altKey: false, shiftKey: false, metaKey: false }); +// We use dispatchEvent() here because if eventSender.keyDown() is used +// instead, this test will fail when run with the WPE port. +input.dispatchEvent(enterKeyEvent); diff --git a/LayoutTests/fast/forms/onchange-change-type.html b/LayoutTests/fast/forms/onchange-change-type.html index 27eb1590a05de..42f706a42d71b 100644 --- a/LayoutTests/fast/forms/onchange-change-type.html +++ b/LayoutTests/fast/forms/onchange-change-type.html @@ -2,12 +2,6 @@