haikuwebkit/LayoutTests/fast/events/input-event-insert-replacem...

24 lines
1.3 KiB
Plaintext
Raw Permalink Normal View History

Picking an emoji via the emoji dialog (Ctrl+Cmd+Space) fires inconsistent beforeinput events. https://bugs.webkit.org/show_bug.cgi?id=170955 <rdar://problem/31697653> Reviewed by Ryosuke Niwa. Source/WebKit: Currently, we insert text with TextEventInputAutocompletion as the text event input type if any text range to replace was specified by the platform. Instead, limit this only to when the text replacement range is not empty. This more closely matches the intention of the spec, which states that the "insertReplacementText" inputType should be used when "[replacing] existing text by means of a spell checker, auto-correct or similar". * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::insertTextAsync): Source/WebKitLegacy/mac: Tweak -insertText: to pass TextEventInputAutocompletion to Editor::insertText when inserting text, if existing text is being replaced. * WebView/WebHTMLView.mm: (-[WebHTMLView insertText:]): Tools: Replace UIScriptController.insertText with UIScriptController.replaceTextAtRange, and implement replaceTextAtRange in WebKit1. See corresponding layout tests (input-event-insert-replacement.html and before-input-prevent-insert-replacement.html) for more detail. * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: * DumpRenderTree/mac/AppKitTestSPI.h: Added. Introduce an SPI header for private AppKit headers needed to support DumpRenderTree. * DumpRenderTree/mac/UIScriptControllerMac.mm: (WTR::UIScriptController::replaceTextAtRange): (WTR::UIScriptController::insertText): Deleted. * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: * TestRunnerShared/UIScriptContext/UIScriptController.cpp: (WTR::UIScriptController::replaceTextAtRange): (WTR::UIScriptController::insertText): Deleted. * TestRunnerShared/UIScriptContext/UIScriptController.h: * WebKitTestRunner/mac/UIScriptControllerMac.mm: (WTR::UIScriptController::replaceTextAtRange): (WTR::UIScriptController::insertText): Deleted. Replace UIScriptController.insertText with UIScriptController.replaceTextAtRange, which better describes the behavior of this function. LayoutTests: Augments two existing layout tests to check for additional cases of inserting text with replacement ranges. Also enables this test for WebKit1 on Mac. Both these tests are currently enabled only for WebKit2, and also only check the case where we're replacing an existing non-empty range of text. * fast/events/before-input-prevent-insert-replacement-expected.txt: * fast/events/before-input-prevent-insert-replacement.html: * fast/events/input-event-insert-replacement-expected.txt: * fast/events/input-event-insert-replacement.html: Tests for cases of replacing existing text ranges, and inserting text at a position. * platform/mac-wk1/TestExpectations: * resources/ui-helper.js: Add a new UIHelper function to insert text at a given replacement range. This codepath is taken when selecting an emoji using the emoji picker menu on Mac, and also when selecting a dead key option after holding down on a vowel key. (window.UIHelper.replaceTextAtRange): Canonical link: https://commits.webkit.org/192681@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221234 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-28 05:12:56 +00:00
To manually test, press and hold down 'a' and select one of the accented characters."
You should observe a pair of beforeinput/input events for both 'a' and the replacement accented character."
Importantly, the inputType of these four events should be 'insertReplacementText'."
Then insert a single emoji character. You should observe beforeinput/input events for the inserted emoji."
Importantly, the inputType of these two events should be 'insertText'."
Holding down a key to choose an accented character should fire "insertReplacementText" input events https://bugs.webkit.org/show_bug.cgi?id=164209 <rdar://problem/29019305> Reviewed by Darin Adler. Source/WebCore: For TypingCommands that correspond to "insertReplacementText" inputTypes, vend dataTransfers for resulting beforeinput and input events if the edited area is not an input field or textarea. To do this, convert the plain text representation of the content to be inserted to HTML text using a helper function, MarkupAccumulator::appendCharactersReplacingEntities, that is used when creating markup for Text nodes. Tests: fast/events/before-input-prevent-insert-replacement.html fast/events/input-event-insert-replacement.html * editing/TypingCommand.cpp: (WebCore::TypingCommand::inputEventData): (WebCore::TypingCommand::inputEventDataTransfer): * editing/TypingCommand.h: Source/WebKit2: When replacing text, call Editor::insertText with the correct TextEventInputType so that WebCore will know to use EditActionInsertReplacement when creating and applying the corresponding TypingCommand. Additional minor changes in order to support testing replacement text insertion. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _insertText:replacementRange:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::insertTextAsync): Tools: Adds test support for inserting replacement text on Mac. This is equivalent to holding down a vowel key (e.g. 'a') to bring up the menu containing accented version of the character, then selecting an accented character to insert in place of the typed character. This is exposed via UIScriptController.insertText, which takes a string and an insertion range. * DumpRenderTree/mac/UIScriptControllerMac.mm: (WTR::UIScriptController::insertText): * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: Note that there is no callback argument to insertText, since UIScriptController::insertText is synchronous in the UI process. The tests end when corresponding input events fired as a result of insertText have been received in the web process. Please see the new layout tests for more detail. * TestRunnerShared/UIScriptContext/UIScriptController.cpp: (WTR::UIScriptController::insertText): * TestRunnerShared/UIScriptContext/UIScriptController.h: * WebKitTestRunner/mac/UIScriptControllerMac.mm: (WTR::nsStringFromJSString): (WTR::UIScriptController::insertText): LayoutTests: Adds 2 new layout tests to verify that inserting replacement text fires input events of inputType "insertReplacementText" instead of the generic "insertText", and that calling preventDefault() on the beforeinput event prevents text from being inserted. Also checks that inserting replacement text in contenteditable areas causes the dataTransfer attribute to be populated, and that the data attribute is null. * fast/events/before-input-prevent-insert-replacement-expected.txt: Added. * fast/events/before-input-prevent-insert-replacement.html: Added. * fast/events/input-event-insert-replacement-expected.txt: Added. * fast/events/input-event-insert-replacement.html: Added. * platform/ios-simulator/TestExpectations: * platform/mac-wk1/TestExpectations: Canonical link: https://commits.webkit.org/181925@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208143 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-31 15:12:00 +00:00
Picking an emoji via the emoji dialog (Ctrl+Cmd+Space) fires inconsistent beforeinput events. https://bugs.webkit.org/show_bug.cgi?id=170955 <rdar://problem/31697653> Reviewed by Ryosuke Niwa. Source/WebKit: Currently, we insert text with TextEventInputAutocompletion as the text event input type if any text range to replace was specified by the platform. Instead, limit this only to when the text replacement range is not empty. This more closely matches the intention of the spec, which states that the "insertReplacementText" inputType should be used when "[replacing] existing text by means of a spell checker, auto-correct or similar". * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::insertTextAsync): Source/WebKitLegacy/mac: Tweak -insertText: to pass TextEventInputAutocompletion to Editor::insertText when inserting text, if existing text is being replaced. * WebView/WebHTMLView.mm: (-[WebHTMLView insertText:]): Tools: Replace UIScriptController.insertText with UIScriptController.replaceTextAtRange, and implement replaceTextAtRange in WebKit1. See corresponding layout tests (input-event-insert-replacement.html and before-input-prevent-insert-replacement.html) for more detail. * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: * DumpRenderTree/mac/AppKitTestSPI.h: Added. Introduce an SPI header for private AppKit headers needed to support DumpRenderTree. * DumpRenderTree/mac/UIScriptControllerMac.mm: (WTR::UIScriptController::replaceTextAtRange): (WTR::UIScriptController::insertText): Deleted. * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: * TestRunnerShared/UIScriptContext/UIScriptController.cpp: (WTR::UIScriptController::replaceTextAtRange): (WTR::UIScriptController::insertText): Deleted. * TestRunnerShared/UIScriptContext/UIScriptController.h: * WebKitTestRunner/mac/UIScriptControllerMac.mm: (WTR::UIScriptController::replaceTextAtRange): (WTR::UIScriptController::insertText): Deleted. Replace UIScriptController.insertText with UIScriptController.replaceTextAtRange, which better describes the behavior of this function. LayoutTests: Augments two existing layout tests to check for additional cases of inserting text with replacement ranges. Also enables this test for WebKit1 on Mac. Both these tests are currently enabled only for WebKit2, and also only check the case where we're replacing an existing non-empty range of text. * fast/events/before-input-prevent-insert-replacement-expected.txt: * fast/events/before-input-prevent-insert-replacement.html: * fast/events/input-event-insert-replacement-expected.txt: * fast/events/input-event-insert-replacement.html: Tests for cases of replacing existing text ranges, and inserting text at a position. * platform/mac-wk1/TestExpectations: * resources/ui-helper.js: Add a new UIHelper function to insert text at a given replacement range. This codepath is taken when selecting an emoji using the emoji picker menu on Mac, and also when selecting a dead key option after holding down on a vowel key. (window.UIHelper.replaceTextAtRange): Canonical link: https://commits.webkit.org/192681@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221234 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-28 05:12:56 +00:00
(1) Typing 'a'...
(editable): type=beforeinput, inputType=insertText, data=a, dataTransfer=null
(editable): type=input, inputType=insertText, data=a, dataTransfer=null
Holding down a key to choose an accented character should fire "insertReplacementText" input events https://bugs.webkit.org/show_bug.cgi?id=164209 <rdar://problem/29019305> Reviewed by Darin Adler. Source/WebCore: For TypingCommands that correspond to "insertReplacementText" inputTypes, vend dataTransfers for resulting beforeinput and input events if the edited area is not an input field or textarea. To do this, convert the plain text representation of the content to be inserted to HTML text using a helper function, MarkupAccumulator::appendCharactersReplacingEntities, that is used when creating markup for Text nodes. Tests: fast/events/before-input-prevent-insert-replacement.html fast/events/input-event-insert-replacement.html * editing/TypingCommand.cpp: (WebCore::TypingCommand::inputEventData): (WebCore::TypingCommand::inputEventDataTransfer): * editing/TypingCommand.h: Source/WebKit2: When replacing text, call Editor::insertText with the correct TextEventInputType so that WebCore will know to use EditActionInsertReplacement when creating and applying the corresponding TypingCommand. Additional minor changes in order to support testing replacement text insertion. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _insertText:replacementRange:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::insertTextAsync): Tools: Adds test support for inserting replacement text on Mac. This is equivalent to holding down a vowel key (e.g. 'a') to bring up the menu containing accented version of the character, then selecting an accented character to insert in place of the typed character. This is exposed via UIScriptController.insertText, which takes a string and an insertion range. * DumpRenderTree/mac/UIScriptControllerMac.mm: (WTR::UIScriptController::insertText): * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: Note that there is no callback argument to insertText, since UIScriptController::insertText is synchronous in the UI process. The tests end when corresponding input events fired as a result of insertText have been received in the web process. Please see the new layout tests for more detail. * TestRunnerShared/UIScriptContext/UIScriptController.cpp: (WTR::UIScriptController::insertText): * TestRunnerShared/UIScriptContext/UIScriptController.h: * WebKitTestRunner/mac/UIScriptControllerMac.mm: (WTR::nsStringFromJSString): (WTR::UIScriptController::insertText): LayoutTests: Adds 2 new layout tests to verify that inserting replacement text fires input events of inputType "insertReplacementText" instead of the generic "insertText", and that calling preventDefault() on the beforeinput event prevents text from being inserted. Also checks that inserting replacement text in contenteditable areas causes the dataTransfer attribute to be populated, and that the data attribute is null. * fast/events/before-input-prevent-insert-replacement-expected.txt: Added. * fast/events/before-input-prevent-insert-replacement.html: Added. * fast/events/input-event-insert-replacement-expected.txt: Added. * fast/events/input-event-insert-replacement.html: Added. * platform/ios-simulator/TestExpectations: * platform/mac-wk1/TestExpectations: Canonical link: https://commits.webkit.org/181925@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208143 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-31 15:12:00 +00:00
The value of the input is now: a
Picking an emoji via the emoji dialog (Ctrl+Cmd+Space) fires inconsistent beforeinput events. https://bugs.webkit.org/show_bug.cgi?id=170955 <rdar://problem/31697653> Reviewed by Ryosuke Niwa. Source/WebKit: Currently, we insert text with TextEventInputAutocompletion as the text event input type if any text range to replace was specified by the platform. Instead, limit this only to when the text replacement range is not empty. This more closely matches the intention of the spec, which states that the "insertReplacementText" inputType should be used when "[replacing] existing text by means of a spell checker, auto-correct or similar". * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::insertTextAsync): Source/WebKitLegacy/mac: Tweak -insertText: to pass TextEventInputAutocompletion to Editor::insertText when inserting text, if existing text is being replaced. * WebView/WebHTMLView.mm: (-[WebHTMLView insertText:]): Tools: Replace UIScriptController.insertText with UIScriptController.replaceTextAtRange, and implement replaceTextAtRange in WebKit1. See corresponding layout tests (input-event-insert-replacement.html and before-input-prevent-insert-replacement.html) for more detail. * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: * DumpRenderTree/mac/AppKitTestSPI.h: Added. Introduce an SPI header for private AppKit headers needed to support DumpRenderTree. * DumpRenderTree/mac/UIScriptControllerMac.mm: (WTR::UIScriptController::replaceTextAtRange): (WTR::UIScriptController::insertText): Deleted. * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: * TestRunnerShared/UIScriptContext/UIScriptController.cpp: (WTR::UIScriptController::replaceTextAtRange): (WTR::UIScriptController::insertText): Deleted. * TestRunnerShared/UIScriptContext/UIScriptController.h: * WebKitTestRunner/mac/UIScriptControllerMac.mm: (WTR::UIScriptController::replaceTextAtRange): (WTR::UIScriptController::insertText): Deleted. Replace UIScriptController.insertText with UIScriptController.replaceTextAtRange, which better describes the behavior of this function. LayoutTests: Augments two existing layout tests to check for additional cases of inserting text with replacement ranges. Also enables this test for WebKit1 on Mac. Both these tests are currently enabled only for WebKit2, and also only check the case where we're replacing an existing non-empty range of text. * fast/events/before-input-prevent-insert-replacement-expected.txt: * fast/events/before-input-prevent-insert-replacement.html: * fast/events/input-event-insert-replacement-expected.txt: * fast/events/input-event-insert-replacement.html: Tests for cases of replacing existing text ranges, and inserting text at a position. * platform/mac-wk1/TestExpectations: * resources/ui-helper.js: Add a new UIHelper function to insert text at a given replacement range. This codepath is taken when selecting an emoji using the emoji picker menu on Mac, and also when selecting a dead key option after holding down on a vowel key. (window.UIHelper.replaceTextAtRange): Canonical link: https://commits.webkit.org/192681@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221234 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-28 05:12:56 +00:00
(2) Replacing 'a' with 'b'...
(editable): type=beforeinput, inputType=insertReplacementText, data=b, dataTransfer=null
(editable): type=input, inputType=insertReplacementText, data=b, dataTransfer=null
Holding down a key to choose an accented character should fire "insertReplacementText" input events https://bugs.webkit.org/show_bug.cgi?id=164209 <rdar://problem/29019305> Reviewed by Darin Adler. Source/WebCore: For TypingCommands that correspond to "insertReplacementText" inputTypes, vend dataTransfers for resulting beforeinput and input events if the edited area is not an input field or textarea. To do this, convert the plain text representation of the content to be inserted to HTML text using a helper function, MarkupAccumulator::appendCharactersReplacingEntities, that is used when creating markup for Text nodes. Tests: fast/events/before-input-prevent-insert-replacement.html fast/events/input-event-insert-replacement.html * editing/TypingCommand.cpp: (WebCore::TypingCommand::inputEventData): (WebCore::TypingCommand::inputEventDataTransfer): * editing/TypingCommand.h: Source/WebKit2: When replacing text, call Editor::insertText with the correct TextEventInputType so that WebCore will know to use EditActionInsertReplacement when creating and applying the corresponding TypingCommand. Additional minor changes in order to support testing replacement text insertion. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _insertText:replacementRange:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::insertTextAsync): Tools: Adds test support for inserting replacement text on Mac. This is equivalent to holding down a vowel key (e.g. 'a') to bring up the menu containing accented version of the character, then selecting an accented character to insert in place of the typed character. This is exposed via UIScriptController.insertText, which takes a string and an insertion range. * DumpRenderTree/mac/UIScriptControllerMac.mm: (WTR::UIScriptController::insertText): * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: Note that there is no callback argument to insertText, since UIScriptController::insertText is synchronous in the UI process. The tests end when corresponding input events fired as a result of insertText have been received in the web process. Please see the new layout tests for more detail. * TestRunnerShared/UIScriptContext/UIScriptController.cpp: (WTR::UIScriptController::insertText): * TestRunnerShared/UIScriptContext/UIScriptController.h: * WebKitTestRunner/mac/UIScriptControllerMac.mm: (WTR::nsStringFromJSString): (WTR::UIScriptController::insertText): LayoutTests: Adds 2 new layout tests to verify that inserting replacement text fires input events of inputType "insertReplacementText" instead of the generic "insertText", and that calling preventDefault() on the beforeinput event prevents text from being inserted. Also checks that inserting replacement text in contenteditable areas causes the dataTransfer attribute to be populated, and that the data attribute is null. * fast/events/before-input-prevent-insert-replacement-expected.txt: Added. * fast/events/before-input-prevent-insert-replacement.html: Added. * fast/events/input-event-insert-replacement-expected.txt: Added. * fast/events/input-event-insert-replacement.html: Added. * platform/ios-simulator/TestExpectations: * platform/mac-wk1/TestExpectations: Canonical link: https://commits.webkit.org/181925@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208143 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-31 15:12:00 +00:00
The value of the input is now: b
Picking an emoji via the emoji dialog (Ctrl+Cmd+Space) fires inconsistent beforeinput events. https://bugs.webkit.org/show_bug.cgi?id=170955 <rdar://problem/31697653> Reviewed by Ryosuke Niwa. Source/WebKit: Currently, we insert text with TextEventInputAutocompletion as the text event input type if any text range to replace was specified by the platform. Instead, limit this only to when the text replacement range is not empty. This more closely matches the intention of the spec, which states that the "insertReplacementText" inputType should be used when "[replacing] existing text by means of a spell checker, auto-correct or similar". * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::insertTextAsync): Source/WebKitLegacy/mac: Tweak -insertText: to pass TextEventInputAutocompletion to Editor::insertText when inserting text, if existing text is being replaced. * WebView/WebHTMLView.mm: (-[WebHTMLView insertText:]): Tools: Replace UIScriptController.insertText with UIScriptController.replaceTextAtRange, and implement replaceTextAtRange in WebKit1. See corresponding layout tests (input-event-insert-replacement.html and before-input-prevent-insert-replacement.html) for more detail. * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj: * DumpRenderTree/mac/AppKitTestSPI.h: Added. Introduce an SPI header for private AppKit headers needed to support DumpRenderTree. * DumpRenderTree/mac/UIScriptControllerMac.mm: (WTR::UIScriptController::replaceTextAtRange): (WTR::UIScriptController::insertText): Deleted. * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: * TestRunnerShared/UIScriptContext/UIScriptController.cpp: (WTR::UIScriptController::replaceTextAtRange): (WTR::UIScriptController::insertText): Deleted. * TestRunnerShared/UIScriptContext/UIScriptController.h: * WebKitTestRunner/mac/UIScriptControllerMac.mm: (WTR::UIScriptController::replaceTextAtRange): (WTR::UIScriptController::insertText): Deleted. Replace UIScriptController.insertText with UIScriptController.replaceTextAtRange, which better describes the behavior of this function. LayoutTests: Augments two existing layout tests to check for additional cases of inserting text with replacement ranges. Also enables this test for WebKit1 on Mac. Both these tests are currently enabled only for WebKit2, and also only check the case where we're replacing an existing non-empty range of text. * fast/events/before-input-prevent-insert-replacement-expected.txt: * fast/events/before-input-prevent-insert-replacement.html: * fast/events/input-event-insert-replacement-expected.txt: * fast/events/input-event-insert-replacement.html: Tests for cases of replacing existing text ranges, and inserting text at a position. * platform/mac-wk1/TestExpectations: * resources/ui-helper.js: Add a new UIHelper function to insert text at a given replacement range. This codepath is taken when selecting an emoji using the emoji picker menu on Mac, and also when selecting a dead key option after holding down on a vowel key. (window.UIHelper.replaceTextAtRange): Canonical link: https://commits.webkit.org/192681@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221234 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-08-28 05:12:56 +00:00
(3) Inserting 'c' after 'b'...
(editable): type=beforeinput, inputType=insertText, data=c, dataTransfer=null
(editable): type=input, inputType=insertText, data=c, dataTransfer=null
The value of the input is now: bc
(4) Selecting all and replacing with 'd'...
(editable): type=beforeinput, inputType=insertReplacementText, data=d, dataTransfer=null
(editable): type=input, inputType=insertReplacementText, data=d, dataTransfer=null
The value of the input is now: d
Holding down a key to choose an accented character should fire "insertReplacementText" input events https://bugs.webkit.org/show_bug.cgi?id=164209 <rdar://problem/29019305> Reviewed by Darin Adler. Source/WebCore: For TypingCommands that correspond to "insertReplacementText" inputTypes, vend dataTransfers for resulting beforeinput and input events if the edited area is not an input field or textarea. To do this, convert the plain text representation of the content to be inserted to HTML text using a helper function, MarkupAccumulator::appendCharactersReplacingEntities, that is used when creating markup for Text nodes. Tests: fast/events/before-input-prevent-insert-replacement.html fast/events/input-event-insert-replacement.html * editing/TypingCommand.cpp: (WebCore::TypingCommand::inputEventData): (WebCore::TypingCommand::inputEventDataTransfer): * editing/TypingCommand.h: Source/WebKit2: When replacing text, call Editor::insertText with the correct TextEventInputType so that WebCore will know to use EditActionInsertReplacement when creating and applying the corresponding TypingCommand. Additional minor changes in order to support testing replacement text insertion. * UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _insertText:replacementRange:]): * UIProcess/API/Cocoa/WKWebViewPrivate.h: * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::insertTextAsync): Tools: Adds test support for inserting replacement text on Mac. This is equivalent to holding down a vowel key (e.g. 'a') to bring up the menu containing accented version of the character, then selecting an accented character to insert in place of the typed character. This is exposed via UIScriptController.insertText, which takes a string and an insertion range. * DumpRenderTree/mac/UIScriptControllerMac.mm: (WTR::UIScriptController::insertText): * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: Note that there is no callback argument to insertText, since UIScriptController::insertText is synchronous in the UI process. The tests end when corresponding input events fired as a result of insertText have been received in the web process. Please see the new layout tests for more detail. * TestRunnerShared/UIScriptContext/UIScriptController.cpp: (WTR::UIScriptController::insertText): * TestRunnerShared/UIScriptContext/UIScriptController.h: * WebKitTestRunner/mac/UIScriptControllerMac.mm: (WTR::nsStringFromJSString): (WTR::UIScriptController::insertText): LayoutTests: Adds 2 new layout tests to verify that inserting replacement text fires input events of inputType "insertReplacementText" instead of the generic "insertText", and that calling preventDefault() on the beforeinput event prevents text from being inserted. Also checks that inserting replacement text in contenteditable areas causes the dataTransfer attribute to be populated, and that the data attribute is null. * fast/events/before-input-prevent-insert-replacement-expected.txt: Added. * fast/events/before-input-prevent-insert-replacement.html: Added. * fast/events/input-event-insert-replacement-expected.txt: Added. * fast/events/input-event-insert-replacement.html: Added. * platform/ios-simulator/TestExpectations: * platform/mac-wk1/TestExpectations: Canonical link: https://commits.webkit.org/181925@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208143 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-31 15:12:00 +00:00