You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[WK2] Data interaction tests occasionally hit assertions in debug builds
https://bugs.webkit.org/show_bug.cgi?id=169002
<rdar://problem/30994806>
Reviewed by Tim Horton.
Source/WebCore:
Data interaction unit tests occasionally fail due to the UI process expecting the latest received EditorState to
contain post layout data, but finding that it does not in -[WKContentView selectedTextRange]. The incomplete
EditorStates in question are sent while performing a data interaction operation, due to transient changes in the
frame selection. The UI process does not need to (and should not) be informed of these selection changes at all.
We can fix this by preventing the editor client from responding to selection changes during data interaction
operation. This patch also renames setIgnoreCompositionSelectionChange to setIgnoreSelectionChanges to better
reflect the fact that it is used outside of the context of holding selection change updates during IME. We
already use this affordance in various places, such as TextIndicator (while taking a snapshot on iOS), in
FindController on iOS, and when replacing selected or dictated text. Additionally, there is no logic in
setIgnoreCompositionSelectionChange that limits its use to composition.
* editing/Editor.cpp:
(WebCore::Editor::cancelCompositionIfSelectionIsInvalid):
(WebCore::Editor::setComposition):
(WebCore::Editor::revealSelectionAfterEditingOperation):
(WebCore::Editor::setIgnoreSelectionChanges):
(WebCore::Editor::changeSelectionAfterCommand):
(WebCore::Editor::respondToChangedSelection):
(WebCore::Editor::setIgnoreCompositionSelectionChange): Deleted.
* editing/Editor.h:
(WebCore::Editor::ignoreSelectionChanges):
(WebCore::Editor::ignoreCompositionSelectionChange): Deleted.
* editing/mac/EditorMac.mm:
(WebCore::Editor::selectionWillChange):
* page/TextIndicator.cpp:
(WebCore::TextIndicator::createWithRange):
Source/WebKit/mac:
Renames setIgnoreCompositionSelectionChange to setIgnoreSelectionChanges. See WebCore ChangeLog for more details.
* WebView/WebHTMLView.mm:
(-[WebHTMLView _updateSelectionForInputManager]):
* WebView/WebView.mm:
(-[WebView updateTextTouchBar]):
Source/WebKit2:
Renames setIgnoreCompositionSelectionChange to setIgnoreSelectionChanges. See WebCore ChangeLog for more details.
* Shared/EditorState.cpp:
(WebKit::EditorState::encode):
(WebKit::EditorState::decode):
* Shared/EditorState.h:
* UIProcess/gtk/WebPageProxyGtk.cpp:
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::editorStateChanged):
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::editorStateChanged):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::editorState):
(WebKit::WebPage::performDragControllerAction):
(WebKit::WebPage::setComposition):
(WebKit::WebPage::didChangeSelection):
* WebProcess/WebPage/ios/FindControllerIOS.mm:
(WebKit::setSelectionChangeUpdatesEnabledInAllFrames):
(WebKit::FindController::willFindString):
(WebKit::FindController::didFailToFindString):
(WebKit::FindController::didHideFindIndicator):
(WebKit::setCompositionSelectionChangeEnabledInAllFrames): Deleted.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::updateSelectionAppearance):
(WebKit::WebPage::replaceSelectedText):
(WebKit::WebPage::replaceDictatedText):
Tools:
Reenables and refactors data interaction tests.
* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
* TestWebKitAPI/ios/DataInteractionSimulator.h:
* TestWebKitAPI/ios/DataInteractionSimulator.mm:
(-[DataInteractionSimulator _resetSimulatedState]):
(-[DataInteractionSimulator runFrom:to:]):
(-[DataInteractionSimulator _advanceProgress]):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@213902 268f45cc-cd09-0410-ab3c-d52691b4dbfc
// FIXME: Many changes that affect composition node do not go through didChangeSelection(). We need to do something when DOM manipulation affects the composition, because otherwise input method's idea about it will be different from Editor's.
4959
4962
// FIXME: We can't cancel composition when selection changes to NoSelection, but we probably should.
4960
-
if (frame.editor().hasComposition() && !frame.editor().ignoreCompositionSelectionChange() && !frame.selection().isNone()) {
4963
+
if (frame.editor().hasComposition() && !frame.editor().ignoreSelectionChanges() && !frame.selection().isNone()) {
0 commit comments