Changeset 211471 in webkit


Ignore:
Timestamp:
Jan 31, 2017 11:46:31 PM (7 years ago)
Author:
Wenson Hsieh
Message:

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.

Source/WebCore:

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:

LayoutTests:

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:
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r211465 r211471  
     12017-01-31  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Regression (Safari 10.1): Pressing Return in a contenteditable no longer inserts a line break under certain conditions
     4        https://bugs.webkit.org/show_bug.cgi?id=167525
     5        <rdar://problem/30270210>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        Adds a new test covering newline insertion with mutation observers and an input event handler. Also rebaselines
     10        a drag and drop test to account for dispatching input events on the scoped queue.
     11
     12        * fast/events/input-events-drag-and-drop-expected.txt:
     13        * fast/events/input-events-insert-newlines-after-mutation-expected.txt: Added.
     14        * fast/events/input-events-insert-newlines-after-mutation.html: Added.
     15        * platform/ios-simulator/TestExpectations:
     16
    1172017-01-31  Ryan Haddad  <ryanhaddad@apple.com>
    218
  • trunk/LayoutTests/fast/events/input-events-drag-and-drop-expected.txt

    r208014 r211471  
    44Performing drag and drop
    55(source): type=beforeinput, inputType=deleteByDrag, data=`null`
     6(destination): type=beforeinput, inputType=insertFromDrop, data=`Input events!`
    67(source): type=input, inputType=deleteByDrag, data=`null`
    7 (destination): type=beforeinput, inputType=insertFromDrop, data=`Input events!`
    88(destination): type=input, inputType=insertFromDrop, data=`Input events!`
    99
  • trunk/LayoutTests/platform/ios-simulator/TestExpectations

    r211339 r211471  
    12341234fast/events/input-events-spell-checking-datatransfer.html [ Failure ]
    12351235fast/events/input-events-selection-forecolor-data.html [ Failure ]
     1236fast/events/input-events-insert-newlines-after-mutation.html [ Failure ]
    12361237fast/events/before-input-events-prevent-default.html [ Failure ]
    12371238fast/events/before-input-events-prevent-default-in-textfield.html [ Failure ]
  • trunk/Source/WebCore/ChangeLog

    r211466 r211471  
     12017-01-31  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Regression (Safari 10.1): Pressing Return in a contenteditable no longer inserts a line break under certain conditions
     4        https://bugs.webkit.org/show_bug.cgi?id=167525
     5        <rdar://problem/30270210>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        Test: fast/events/input-events-insert-newlines-after-mutation.html
     10
     11        Reverts an unintended change made while refactoring code for input events that caused input events to be
     12        dispatched immediately rather than on the scoped queue. Normally, input events are dispatched in
     13        CompositeEditCommand::apply after the end of the scope, but TypingCommands may fire input events *from within*
     14        the scope by calling typingAddedToOpenCommand.
     15
     16        Instead, TypingCommands should always dispatch events
     17        synchronously after the end of the scoped queue in CompositeEditCommand::apply, but this is a riskier change
     18        than we should currently allow, so we should revert to our old behavior for the time being.
     19
     20        * editing/Editor.cpp:
     21
    1222017-01-31  Zalan Bujtas  <zalan@apple.com>
    223
  • trunk/Source/WebCore/editing/Editor.cpp

    r211092 r211471  
    118118{
    119119    auto* settings = element.document().settings();
    120     if (settings && settings->inputEventsEnabled())
    121         element.dispatchEvent(InputEvent::create(eventNames().inputEvent, inputType, true, false, element.document().defaultView(), data, WTFMove(dataTransfer), targetRanges, 0));
    122     else
     120    if (settings && settings->inputEventsEnabled()) {
     121        // 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,
     122        // but TypingCommands are special in that existing TypingCommands that are applied again fire input events *from within* the scope by calling typingAddedToOpenCommand.
     123        // Instead, TypingCommands should always dispatch events synchronously after the end of the scoped queue in CompositeEditCommand::apply. To work around this for the
     124        // time being, just revert back to calling dispatchScopedEvent.
     125        element.dispatchScopedEvent(InputEvent::create(eventNames().inputEvent, inputType, true, false, element.document().defaultView(), data, WTFMove(dataTransfer), targetRanges, 0));
     126    } else
    123127        element.dispatchInputEvent();
    124128}
Note: See TracChangeset for help on using the changeset viewer.