3 Support InputEvent.inputType for the new InputEvent spec
4 https://bugs.webkit.org/show_bug.cgi?id=163025
5 <rdar://problem/28658092>
6
7 Reviewed by NOBODY (OOPS!).
8
9 Adds support for the inputType attribute of InputEvent. To do this, we introduce a helper to
10 map EditActions to inputType names, and also split out ambiguous EditActions (such as
11 EditActionTyping) into more specific subtypes (such as EditActionTypingDeleteBackward,
12 EditActionTypingInsertParagraph, etc.), each of which corresponds to an inputType.
13
14 In places where we create CompositeEditCommands, we now pass in these specific EditActions
15 where appropriate, and when dispatching `beforeinput` and `input` events, we ask the
16 CompositeEditCommand for its input type name, which it derives from its editingAction.
17
18 Lastly, adds an Internals test helper that layout tests may use to directly invoke commands on
19 the current document's Editor.
20
21 Tests: fast/events/before-input-prevent-biu.html
22 fast/events/before-input-prevent-cut.html
23 fast/events/before-input-prevent-paste.html
24 fast/events/before-input-prevent-undo.html
25
26 * dom/Node.cpp:
27 (WebCore::Node::dispatchBeforeInputEvent):
28 (WebCore::Node::dispatchInputEvent):
29 * editing/CompositeEditCommand.cpp:
30 (WebCore::CompositeEditCommand::apply):
31 (WebCore::CompositeEditCommand::inputEventTypeName):
32
33 Allows a CompositeEditCommand to specify the inputType its corresponding `beforeinput` and `input` events
34 should have.
35
36 * editing/CompositeEditCommand.h:
37 (WebCore::CompositeEditCommand::shouldStopCaretBlinking): Deleted.
38 * editing/EditAction.h:
39 * editing/EditCommand.cpp:
40 (WebCore::inputTypeNameForEditingAction):
41 * editing/EditCommand.h:
42 * editing/Editor.cpp:
43 (WebCore::Editor::willApplyEditing):
44 (WebCore::Editor::appliedEditing):
45 (WebCore::Editor::willUnapplyEditing):
46 (WebCore::Editor::unappliedEditing):
47 (WebCore::Editor::willReapplyEditing):
48 (WebCore::Editor::reappliedEditing):
49 (WebCore::Editor::computeAndSetTypingStyle):
50 * editing/InsertListCommand.cpp:
51 (WebCore::InsertListCommand::editingAction):
52 * editing/InsertListCommand.h:
53 (WebCore::InsertListCommand::preservesTypingStyle): Deleted.
54 (WebCore::InsertListCommand::editingAction): Deleted.
55 * editing/ReplaceRangeWithTextCommand.cpp:
56 (WebCore::ReplaceRangeWithTextCommand::ReplaceRangeWithTextCommand):
57 * editing/SpellingCorrectionCommand.cpp:
58 (WebCore::SpellingCorrectionCommand::SpellingCorrectionCommand):
59 * editing/TypingCommand.cpp:
60 (WebCore::editActionForTypingCommand):
61 (WebCore::TypingCommand::TypingCommand):
62 (WebCore::TypingCommand::inputEventTypeName):
63
64 The editingAction() of a TypingCommand is the first editing action the TypingCommand was initialized using.
65 Since subsequent typing commands update the last open typing command, we override inputEventTypeName here to
66 use the last updated editing action rather than the default (initial) editing action.
67
68 (WebCore::TypingCommand::willAddTypingToOpenCommand):
69 (WebCore::TypingCommand::insertTextRunWithoutNewlines):
70 (WebCore::TypingCommand::insertParagraphSeparator):
71 * editing/TypingCommand.h:
72 * testing/Internals.cpp:
73 (WebCore::Internals::executeEditingCommand):
74
75 Adds a new hook that allows layout tests to execute arbitrary editing commands. This effectively ignores user
76 gesture restrictions on operations like cut and paste.
77
78 * testing/Internals.h:
79 * testing/Internals.idl:
80
812016-10-07 Wenson Hsieh <wenson_hsieh@apple.com>
82