Title: [211692] branches/safari-603-branch

Diff

Modified: branches/safari-603-branch/LayoutTests/ChangeLog (211691 => 211692)


--- branches/safari-603-branch/LayoutTests/ChangeLog	2017-02-06 04:03:27 UTC (rev 211691)
+++ branches/safari-603-branch/LayoutTests/ChangeLog	2017-02-06 04:03:31 UTC (rev 211692)
@@ -1,5 +1,25 @@
 2017-02-02  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r211471. rdar://problem/30270210
+
+    2017-01-31  Wenson Hsieh  <wenson_hs...@apple.com>
+
+            Regression (Safari 10.1): Pressing Return in a contenteditable no longer inserts a line break under certain conditions
+            https://bugs.webkit.org/show_bug.cgi?id=167525
+            <rdar://problem/30270210>
+
+            Reviewed by Ryosuke Niwa.
+
+            Adds a new test covering newline insertion with mutation observers and an input event handler. Also rebaselines
+            a drag and drop test to account for dispatching input events on the scoped queue.
+
+            * fast/events/input-events-drag-and-drop-expected.txt:
+            * fast/events/input-events-insert-newlines-after-mutation-expected.txt: Added.
+            * fast/events/input-events-insert-newlines-after-mutation.html: Added.
+            * platform/ios-simulator/TestExpectations:
+
+2017-02-02  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r211433. rdar://problem/30091558
 
     2017-01-31  Simon Fraser  <simon.fra...@apple.com>

Modified: branches/safari-603-branch/LayoutTests/fast/events/input-events-drag-and-drop-expected.txt (211691 => 211692)


--- branches/safari-603-branch/LayoutTests/fast/events/input-events-drag-and-drop-expected.txt	2017-02-06 04:03:27 UTC (rev 211691)
+++ branches/safari-603-branch/LayoutTests/fast/events/input-events-drag-and-drop-expected.txt	2017-02-06 04:03:31 UTC (rev 211692)
@@ -3,8 +3,8 @@
 
 Performing drag and drop
 (source): type=beforeinput, inputType=deleteByDrag, data=""
+(destination): type=beforeinput, inputType=insertFromDrop, data="" events!`
 (source): type=input, inputType=deleteByDrag, data=""
-(destination): type=beforeinput, inputType=insertFromDrop, data="" events!`
 (destination): type=input, inputType=insertFromDrop, data="" events!`
 
 Undoing drag and drop

Added: branches/safari-603-branch/LayoutTests/fast/events/input-events-insert-newlines-after-mutation-expected.txt (0 => 211692)


--- branches/safari-603-branch/LayoutTests/fast/events/input-events-insert-newlines-after-mutation-expected.txt	                        (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/events/input-events-insert-newlines-after-mutation-expected.txt	2017-02-06 04:03:31 UTC (rev 211692)
@@ -0,0 +1,6 @@
+
+
+
+
+
+To manually test this, press enter multiple times in the editable area. Newlines should be inserted.

Added: branches/safari-603-branch/LayoutTests/fast/events/input-events-insert-newlines-after-mutation.html (0 => 211692)


--- branches/safari-603-branch/LayoutTests/fast/events/input-events-insert-newlines-after-mutation.html	                        (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/events/input-events-insert-newlines-after-mutation.html	2017-02-06 04:03:31 UTC (rev 211692)
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+    (() => {
+        addEventListener("input", () => { });
+        addEventListener("DOMContentLoaded", () => {
+            let editor = document.getElementById("editor");
+            function render() {
+                mutationObserver.disconnect();
+                editor.innerHTML = editor.innerHTML;
+                getSelection().collapse(editor.firstElementChild, 1);
+                mutationObserver.observe(editor, {
+                    childList: true,
+                    attributes: true,
+                    characterData: true,
+                    subtree: true
+                });
+            }
+
+            var mutationObserver = new MutationObserver(render);
+            editor.focus();
+            render();
+
+            function typeNewlines(remaining) {
+                if (!eventSender)
+                    return;
+
+                eventSender.keyDown("\n", []);
+                if (remaining == 0)
+                    testRunner.notifyDone();
+                else {
+                    setTimeout(() => {
+                        typeNewlines(remaining - 1);
+                    }, 100);
+                }
+            }
+
+            typeNewlines(3);
+        });
+    })();
+</script>
+</head>
+<body>
+<div id="editor" contenteditable><div><br></div></div>
+<div>To manually test this, press enter multiple times in the editable area. Newlines should be inserted.</div>
+</body>
+<script>
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+</script>
+</html>

Modified: branches/safari-603-branch/LayoutTests/platform/ios-simulator/TestExpectations (211691 => 211692)


--- branches/safari-603-branch/LayoutTests/platform/ios-simulator/TestExpectations	2017-02-06 04:03:27 UTC (rev 211691)
+++ branches/safari-603-branch/LayoutTests/platform/ios-simulator/TestExpectations	2017-02-06 04:03:31 UTC (rev 211692)
@@ -1231,6 +1231,7 @@
 fast/events/input-events-paste-rich-datatransfer.html [ Failure ]
 fast/events/input-events-spell-checking-datatransfer.html [ Failure ]
 fast/events/input-events-selection-forecolor-data.html [ Failure ]
+fast/events/input-events-insert-newlines-after-mutation.html [ Failure ]
 fast/events/before-input-events-prevent-default.html [ Failure ]
 fast/events/before-input-events-prevent-default-in-textfield.html [ Failure ]
 fast/events/before-input-events-different-start-end-elements.html [ Failure ]

Modified: branches/safari-603-branch/Source/WebCore/ChangeLog (211691 => 211692)


--- branches/safari-603-branch/Source/WebCore/ChangeLog	2017-02-06 04:03:27 UTC (rev 211691)
+++ branches/safari-603-branch/Source/WebCore/ChangeLog	2017-02-06 04:03:31 UTC (rev 211692)
@@ -1,5 +1,30 @@
 2017-02-02  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r211471. rdar://problem/30270210
+
+    2017-01-31  Wenson Hsieh  <wenson_hs...@apple.com>
+
+            Regression (Safari 10.1): Pressing Return in a contenteditable no longer inserts a line break under certain conditions
+            https://bugs.webkit.org/show_bug.cgi?id=167525
+            <rdar://problem/30270210>
+
+            Reviewed by Ryosuke Niwa.
+
+            Test: fast/events/input-events-insert-newlines-after-mutation.html
+
+            Reverts an unintended change made while refactoring code for input events that caused input events to be
+            dispatched immediately rather than on the scoped queue. Normally, input events are dispatched in
+            CompositeEditCommand::apply after the end of the scope, but TypingCommands may fire input events *from within*
+            the scope by calling typingAddedToOpenCommand.
+
+            Instead, TypingCommands should always dispatch events
+            synchronously after the end of the scoped queue in CompositeEditCommand::apply, but this is a riskier change
+            than we should currently allow, so we should revert to our old behavior for the time being.
+
+            * editing/Editor.cpp:
+
+2017-02-02  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r211433. rdar://problem/30091558
 
     2017-01-31  Simon Fraser  <simon.fra...@apple.com>

Modified: branches/safari-603-branch/Source/WebCore/editing/Editor.cpp (211691 => 211692)


--- branches/safari-603-branch/Source/WebCore/editing/Editor.cpp	2017-02-06 04:03:27 UTC (rev 211691)
+++ branches/safari-603-branch/Source/WebCore/editing/Editor.cpp	2017-02-06 04:03:31 UTC (rev 211692)
@@ -116,9 +116,13 @@
 static void dispatchInputEvent(Element& element, const AtomicString& inputType, const String& data = { }, RefPtr<DataTransfer>&& dataTransfer = nullptr, const Vector<RefPtr<StaticRange>>& targetRanges = { })
 {
     auto* settings = element.document().settings();
-    if (settings && settings->inputEventsEnabled())
-        element.dispatchEvent(InputEvent::create(eventNames().inputEvent, inputType, true, false, element.document().defaultView(), data, WTFMove(dataTransfer), targetRanges, 0));
-    else
+    if (settings && settings->inputEventsEnabled()) {
+        // FIXME: We should not be dispatching to the scoped queue here. Normally, input events are dispatched in CompositeEditCommand::apply after the end of the scope,
+        // but TypingCommands are special in that existing TypingCommands that are applied again fire input events *from within* the scope by calling typingAddedToOpenCommand.
+        // Instead, TypingCommands should always dispatch events synchronously after the end of the scoped queue in CompositeEditCommand::apply. To work around this for the
+        // time being, just revert back to calling dispatchScopedEvent.
+        element.dispatchScopedEvent(InputEvent::create(eventNames().inputEvent, inputType, true, false, element.document().defaultView(), data, WTFMove(dataTransfer), targetRanges, 0));
+    } else
         element.dispatchInputEvent();
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to