Skip to content

Commit 1578ab8

Browse files
[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
1 parent 6ee64a3 commit 1578ab8

21 files changed

+160
-81
lines changed

Source/WebCore/ChangeLog

+36
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
2017-03-14 Wenson Hsieh <[email protected]>
2+
3+
[WK2] Data interaction tests occasionally hit assertions in debug builds
4+
https://bugs.webkit.org/show_bug.cgi?id=169002
5+
<rdar://problem/30994806>
6+
7+
Reviewed by Tim Horton.
8+
9+
Data interaction unit tests occasionally fail due to the UI process expecting the latest received EditorState to
10+
contain post layout data, but finding that it does not in -[WKContentView selectedTextRange]. The incomplete
11+
EditorStates in question are sent while performing a data interaction operation, due to transient changes in the
12+
frame selection. The UI process does not need to (and should not) be informed of these selection changes at all.
13+
14+
We can fix this by preventing the editor client from responding to selection changes during data interaction
15+
operation. This patch also renames setIgnoreCompositionSelectionChange to setIgnoreSelectionChanges to better
16+
reflect the fact that it is used outside of the context of holding selection change updates during IME. We
17+
already use this affordance in various places, such as TextIndicator (while taking a snapshot on iOS), in
18+
FindController on iOS, and when replacing selected or dictated text. Additionally, there is no logic in
19+
setIgnoreCompositionSelectionChange that limits its use to composition.
20+
21+
* editing/Editor.cpp:
22+
(WebCore::Editor::cancelCompositionIfSelectionIsInvalid):
23+
(WebCore::Editor::setComposition):
24+
(WebCore::Editor::revealSelectionAfterEditingOperation):
25+
(WebCore::Editor::setIgnoreSelectionChanges):
26+
(WebCore::Editor::changeSelectionAfterCommand):
27+
(WebCore::Editor::respondToChangedSelection):
28+
(WebCore::Editor::setIgnoreCompositionSelectionChange): Deleted.
29+
* editing/Editor.h:
30+
(WebCore::Editor::ignoreSelectionChanges):
31+
(WebCore::Editor::ignoreCompositionSelectionChange): Deleted.
32+
* editing/mac/EditorMac.mm:
33+
(WebCore::Editor::selectionWillChange):
34+
* page/TextIndicator.cpp:
35+
(WebCore::TextIndicator::createWithRange):
36+
137
2017-03-14 Antoine Quint <[email protected]>
238

339
[Modern Media Controls] iOS may attempt to load fullscreen icon variants

Source/WebCore/editing/Editor.cpp

+13-13
Original file line numberDiff line numberDiff line change
@@ -1683,7 +1683,7 @@ bool Editor::cancelCompositionIfSelectionIsInvalid()
16831683
{
16841684
unsigned start;
16851685
unsigned end;
1686-
if (!hasComposition() || ignoreCompositionSelectionChange() || getCompositionSelection(start, end))
1686+
if (!hasComposition() || ignoreSelectionChanges() || getCompositionSelection(start, end))
16871687
return false;
16881688

16891689
cancelComposition();
@@ -1700,7 +1700,7 @@ void Editor::setComposition(const String& text, SetCompositionMode mode)
17001700
ASSERT(mode == ConfirmComposition || mode == CancelComposition);
17011701
UserTypingGestureIndicator typingGestureIndicator(m_frame);
17021702

1703-
setIgnoreCompositionSelectionChange(true);
1703+
setIgnoreSelectionChanges(true);
17041704

17051705
if (mode == CancelComposition)
17061706
ASSERT(text == emptyString());
@@ -1711,7 +1711,7 @@ void Editor::setComposition(const String& text, SetCompositionMode mode)
17111711
m_customCompositionUnderlines.clear();
17121712

17131713
if (m_frame.selection().isNone()) {
1714-
setIgnoreCompositionSelectionChange(false);
1714+
setIgnoreSelectionChanges(false);
17151715
return;
17161716
}
17171717

@@ -1731,7 +1731,7 @@ void Editor::setComposition(const String& text, SetCompositionMode mode)
17311731
TypingCommand::closeTyping(&m_frame);
17321732
}
17331733

1734-
setIgnoreCompositionSelectionChange(false);
1734+
setIgnoreSelectionChanges(false);
17351735
}
17361736

17371737
void Editor::setComposition(const String& text, const Vector<CompositionUnderline>& underlines, unsigned selectionStart, unsigned selectionEnd)
@@ -1740,7 +1740,7 @@ void Editor::setComposition(const String& text, const Vector<CompositionUnderlin
17401740

17411741
UserTypingGestureIndicator typingGestureIndicator(m_frame);
17421742

1743-
setIgnoreCompositionSelectionChange(true);
1743+
setIgnoreSelectionChanges(true);
17441744

17451745
// Updates styles before setting selection for composition to prevent
17461746
// inserting the previous composition text into text nodes oddly.
@@ -1750,7 +1750,7 @@ void Editor::setComposition(const String& text, const Vector<CompositionUnderlin
17501750
selectComposition();
17511751

17521752
if (m_frame.selection().isNone()) {
1753-
setIgnoreCompositionSelectionChange(false);
1753+
setIgnoreSelectionChanges(false);
17541754
return;
17551755
}
17561756

@@ -1843,7 +1843,7 @@ void Editor::setComposition(const String& text, const Vector<CompositionUnderlin
18431843
}
18441844
}
18451845

1846-
setIgnoreCompositionSelectionChange(false);
1846+
setIgnoreSelectionChanges(false);
18471847

18481848
#if PLATFORM(IOS)
18491849
client()->stopDelayingAndCoalescingContentChangeNotifications();
@@ -2775,7 +2775,7 @@ PassRefPtr<Range> Editor::rangeForPoint(const IntPoint& windowPoint)
27752775

27762776
void Editor::revealSelectionAfterEditingOperation(const ScrollAlignment& alignment, RevealExtentOption revealExtentOption)
27772777
{
2778-
if (m_ignoreCompositionSelectionChange)
2778+
if (m_ignoreSelectionChanges)
27792779
return;
27802780

27812781
#if PLATFORM(IOS)
@@ -2787,12 +2787,12 @@ void Editor::revealSelectionAfterEditingOperation(const ScrollAlignment& alignme
27872787
m_frame.selection().revealSelection(revealMode, alignment, revealExtentOption);
27882788
}
27892789

2790-
void Editor::setIgnoreCompositionSelectionChange(bool ignore, RevealSelection shouldRevealExistingSelection)
2790+
void Editor::setIgnoreSelectionChanges(bool ignore, RevealSelection shouldRevealExistingSelection)
27912791
{
2792-
if (m_ignoreCompositionSelectionChange == ignore)
2792+
if (m_ignoreSelectionChanges == ignore)
27932793
return;
27942794

2795-
m_ignoreCompositionSelectionChange = ignore;
2795+
m_ignoreSelectionChanges = ignore;
27962796
#if PLATFORM(IOS)
27972797
// FIXME: Should suppress selection change notifications during a composition change <https://webkit.org/b/38830>
27982798
if (!ignore)
@@ -2944,7 +2944,7 @@ void Editor::changeSelectionAfterCommand(const VisibleSelection& newSelection, F
29442944
// starts a new kill ring sequence, but we want to do these things (matches AppKit).
29452945
#if PLATFORM(IOS)
29462946
// FIXME: Should suppress selection change notifications during a composition change <https://webkit.org/b/38830>
2947-
if (m_ignoreCompositionSelectionChange)
2947+
if (m_ignoreSelectionChanges)
29482948
return;
29492949
#endif
29502950
if (selectionDidNotChangeDOMPosition && client())
@@ -3286,7 +3286,7 @@ void Editor::respondToChangedSelection(const VisibleSelection&, FrameSelection::
32863286
{
32873287
#if PLATFORM(IOS)
32883288
// FIXME: Should suppress selection change notifications during a composition change <https://webkit.org/b/38830>
3289-
if (m_ignoreCompositionSelectionChange)
3289+
if (m_ignoreSelectionChanges)
32903290
return;
32913291
#endif
32923292

Source/WebCore/editing/Editor.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,8 @@ class Editor {
334334
const Vector<CompositionUnderline>& customCompositionUnderlines() const { return m_customCompositionUnderlines; }
335335

336336
enum class RevealSelection { No, Yes };
337-
WEBCORE_EXPORT void setIgnoreCompositionSelectionChange(bool, RevealSelection shouldRevealExistingSelection = RevealSelection::Yes);
338-
bool ignoreCompositionSelectionChange() const { return m_ignoreCompositionSelectionChange; }
337+
WEBCORE_EXPORT void setIgnoreSelectionChanges(bool, RevealSelection shouldRevealExistingSelection = RevealSelection::Yes);
338+
bool ignoreSelectionChanges() const { return m_ignoreSelectionChanges; }
339339

340340
WEBCORE_EXPORT PassRefPtr<Range> rangeForPoint(const IntPoint& windowPoint);
341341

@@ -544,7 +544,7 @@ class Editor {
544544
unsigned m_compositionStart;
545545
unsigned m_compositionEnd;
546546
Vector<CompositionUnderline> m_customCompositionUnderlines;
547-
bool m_ignoreCompositionSelectionChange { false };
547+
bool m_ignoreSelectionChanges { false };
548548
bool m_shouldStartNewKillRingSequence { false };
549549
bool m_shouldStyleWithCSS { false };
550550
const std::unique_ptr<KillRing> m_killRing;

Source/WebCore/editing/mac/EditorMac.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ static void getImage(Element& imageElement, RefPtr<Image>& image, CachedImage*&
258258

259259
void Editor::selectionWillChange()
260260
{
261-
if (!hasComposition() || ignoreCompositionSelectionChange() || m_frame.selection().isNone())
261+
if (!hasComposition() || ignoreSelectionChanges() || m_frame.selection().isNone())
262262
return;
263263

264264
cancelComposition();

Source/WebCore/page/TextIndicator.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ RefPtr<TextIndicator> TextIndicator::createWithRange(const Range& range, TextInd
7171
Ref<Frame> protector(*frame);
7272

7373
#if PLATFORM(IOS)
74-
frame->editor().setIgnoreCompositionSelectionChange(true);
74+
frame->editor().setIgnoreSelectionChanges(true);
7575
frame->selection().setUpdateAppearanceEnabled(true);
7676
#endif
7777

@@ -93,7 +93,7 @@ RefPtr<TextIndicator> TextIndicator::createWithRange(const Range& range, TextInd
9393
frame->selection().setSelection(oldSelection);
9494

9595
#if PLATFORM(IOS)
96-
frame->editor().setIgnoreCompositionSelectionChange(false, Editor::RevealSelection::No);
96+
frame->editor().setIgnoreSelectionChanges(false, Editor::RevealSelection::No);
9797
frame->selection().setUpdateAppearanceEnabled(false);
9898
#endif
9999

Source/WebKit/mac/ChangeLog

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
2017-03-14 Wenson Hsieh <[email protected]>
2+
3+
[WK2] Data interaction tests occasionally hit assertions in debug builds
4+
https://bugs.webkit.org/show_bug.cgi?id=169002
5+
<rdar://problem/30994806>
6+
7+
Reviewed by Tim Horton.
8+
9+
Renames setIgnoreCompositionSelectionChange to setIgnoreSelectionChanges. See WebCore ChangeLog for more details.
10+
11+
* WebView/WebHTMLView.mm:
12+
(-[WebHTMLView _updateSelectionForInputManager]):
13+
* WebView/WebView.mm:
14+
(-[WebView updateTextTouchBar]):
15+
116
2017-03-13 Anders Carlsson <[email protected]>
217

318
Fix build warnings.

Source/WebKit/mac/WebView/WebHTMLView.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -7211,7 +7211,7 @@ - (void)_updateSelectionForInputManager
72117211

72127212
[self _updateSecureInputState];
72137213

7214-
if (!coreFrame->editor().hasComposition() || coreFrame->editor().ignoreCompositionSelectionChange())
7214+
if (!coreFrame->editor().hasComposition() || coreFrame->editor().ignoreSelectionChanges())
72157215
return;
72167216

72177217
unsigned start;

Source/WebKit/mac/WebView/WebView.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -9616,7 +9616,7 @@ - (void)updateTextTouchBar
96169616
}
96179617

96189618
if ([NSSpellChecker isAutomaticTextCompletionEnabled] && !_private->_isCustomizingTouchBar) {
9619-
BOOL shouldShowCandidateList = !coreFrame->selection().selection().isRange() || coreFrame->editor().ignoreCompositionSelectionChange();
9619+
BOOL shouldShowCandidateList = !coreFrame->selection().selection().isRange() || coreFrame->editor().ignoreSelectionChanges();
96209620
[self.candidateList updateWithInsertionPointVisibility:shouldShowCandidateList];
96219621
}
96229622

Source/WebKit2/ChangeLog

+35
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,38 @@
1+
2017-03-14 Wenson Hsieh <[email protected]>
2+
3+
[WK2] Data interaction tests occasionally hit assertions in debug builds
4+
https://bugs.webkit.org/show_bug.cgi?id=169002
5+
<rdar://problem/30994806>
6+
7+
Reviewed by Tim Horton.
8+
9+
Renames setIgnoreCompositionSelectionChange to setIgnoreSelectionChanges. See WebCore ChangeLog for more details.
10+
11+
* Shared/EditorState.cpp:
12+
(WebKit::EditorState::encode):
13+
(WebKit::EditorState::decode):
14+
* Shared/EditorState.h:
15+
* UIProcess/gtk/WebPageProxyGtk.cpp:
16+
* UIProcess/ios/WebPageProxyIOS.mm:
17+
(WebKit::WebPageProxy::editorStateChanged):
18+
* UIProcess/mac/WebPageProxyMac.mm:
19+
(WebKit::WebPageProxy::editorStateChanged):
20+
* WebProcess/WebPage/WebPage.cpp:
21+
(WebKit::WebPage::editorState):
22+
(WebKit::WebPage::performDragControllerAction):
23+
(WebKit::WebPage::setComposition):
24+
(WebKit::WebPage::didChangeSelection):
25+
* WebProcess/WebPage/ios/FindControllerIOS.mm:
26+
(WebKit::setSelectionChangeUpdatesEnabledInAllFrames):
27+
(WebKit::FindController::willFindString):
28+
(WebKit::FindController::didFailToFindString):
29+
(WebKit::FindController::didHideFindIndicator):
30+
(WebKit::setCompositionSelectionChangeEnabledInAllFrames): Deleted.
31+
* WebProcess/WebPage/ios/WebPageIOS.mm:
32+
(WebKit::WebPage::updateSelectionAppearance):
33+
(WebKit::WebPage::replaceSelectedText):
34+
(WebKit::WebPage::replaceDictatedText):
35+
136
2017-03-14 Carlos Garcia Campos <[email protected]>
237

338
Unreviewed. Fix syntax error in GTK+ API docs.

Source/WebKit2/Shared/EditorState.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace WebKit {
3232

3333
void EditorState::encode(IPC::Encoder& encoder) const
3434
{
35-
encoder << shouldIgnoreCompositionSelectionChange;
35+
encoder << shouldIgnoreSelectionChanges;
3636
encoder << selectionIsNone;
3737
encoder << selectionIsRange;
3838
encoder << isContentEditable;
@@ -56,7 +56,7 @@ void EditorState::encode(IPC::Encoder& encoder) const
5656

5757
bool EditorState::decode(IPC::Decoder& decoder, EditorState& result)
5858
{
59-
if (!decoder.decode(result.shouldIgnoreCompositionSelectionChange))
59+
if (!decoder.decode(result.shouldIgnoreSelectionChanges))
6060
return false;
6161

6262
if (!decoder.decode(result.selectionIsNone))

Source/WebKit2/Shared/EditorState.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ enum ListType {
6060
};
6161

6262
struct EditorState {
63-
bool shouldIgnoreCompositionSelectionChange { false };
63+
bool shouldIgnoreSelectionChanges { false };
6464

6565
bool selectionIsNone { true }; // This will be false when there is a caret selection.
6666
bool selectionIsRange { false };

Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void WebPageProxy::editorStateChanged(const EditorState& editorState)
7979
{
8080
m_editorState = editorState;
8181

82-
if (editorState.shouldIgnoreCompositionSelectionChange)
82+
if (editorState.shouldIgnoreSelectionChanges)
8383
return;
8484
if (m_editorState.selectionIsRange)
8585
WebPasteboardProxy::singleton().setPrimarySelectionOwner(focusedFrame());

Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ static bool exceedsRenderTreeSizeSizeThreshold(uint64_t thresholdSize, uint64_t
10851085
if (couldChangeSecureInputState && !editorState.selectionIsNone)
10861086
m_pageClient.updateSecureInputState();
10871087

1088-
if (editorState.shouldIgnoreCompositionSelectionChange)
1088+
if (editorState.shouldIgnoreSelectionChanges)
10891089
return;
10901090

10911091
// We always need to notify the client on iOS to make sure the selection is redrawn,

Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ static String webKitBundleVersionString()
574574
if (couldChangeSecureInputState && !editorState.selectionIsNone)
575575
m_pageClient.updateSecureInputState();
576576

577-
if (editorState.shouldIgnoreCompositionSelectionChange)
577+
if (editorState.shouldIgnoreSelectionChanges)
578578
return;
579579

580580
m_pageClient.selectionDidChange();

Source/WebKit2/WebProcess/WebPage/WebPage.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,7 @@ EditorState WebPage::editorState(IncludePostLayoutDataHint shouldIncludePostLayo
831831
result.isContentRichlyEditable = selection.isContentRichlyEditable();
832832
result.isInPasswordField = selection.isInPasswordField();
833833
result.hasComposition = frame.editor().hasComposition();
834-
result.shouldIgnoreCompositionSelectionChange = frame.editor().ignoreCompositionSelectionChange();
834+
result.shouldIgnoreSelectionChanges = frame.editor().ignoreSelectionChanges();
835835

836836
#if PLATFORM(COCOA)
837837
if (shouldIncludePostLayoutData == IncludePostLayoutDataHint::Yes && result.isContentEditable) {
@@ -3525,7 +3525,10 @@ void WebPage::performDragControllerAction(uint64_t action, const WebCore::DragDa
35253525
m_pendingDropExtensionsForFileUpload.append(extension);
35263526
}
35273527

3528+
auto& frame = m_page->focusController().focusedOrMainFrame();
3529+
frame.editor().setIgnoreSelectionChanges(true);
35283530
m_page->dragController().performDragOperation(dragData);
3531+
frame.editor().setIgnoreSelectionChanges(false);
35293532

35303533
// If we started loading a local file, the sandbox extension tracker would have adopted this
35313534
// pending drop sandbox extension. If not, we'll play it safe and clear it.
@@ -4861,9 +4864,9 @@ void WebPage::setComposition(const String& text, const Vector<CompositionUnderli
48614864

48624865
Element* scope = targetFrame->selection().selection().rootEditableElement();
48634866
RefPtr<Range> replacementRange = TextIterator::rangeFromLocationAndLength(scope, replacementStart, replacementLength);
4864-
targetFrame->editor().setIgnoreCompositionSelectionChange(true);
4867+
targetFrame->editor().setIgnoreSelectionChanges(true);
48654868
targetFrame->selection().setSelection(VisibleSelection(*replacementRange, SEL_DEFAULT_AFFINITY));
4866-
targetFrame->editor().setIgnoreCompositionSelectionChange(false);
4869+
targetFrame->editor().setIgnoreSelectionChanges(false);
48674870
}
48684871

48694872
targetFrame->editor().setComposition(text, underlines, selectionStart, selectionStart + selectionLength);
@@ -4957,7 +4960,7 @@ void WebPage::didChangeSelection()
49574960
// FIXME: This logic should be in WebCore.
49584961
// 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.
49594962
// 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()) {
49614964
frame.editor().cancelComposition();
49624965
discardedComposition();
49634966
} else

Source/WebKit2/WebProcess/WebPage/ios/FindControllerIOS.mm

+5-5
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,15 @@ static Color highlightColor()
131131
didHideFindIndicator();
132132
}
133133

134-
static void setCompositionSelectionChangeEnabledInAllFrames(WebPage& page, bool enabled)
134+
static void setSelectionChangeUpdatesEnabledInAllFrames(WebPage& page, bool enabled)
135135
{
136136
for (Frame* coreFrame = page.mainFrame(); coreFrame; coreFrame = coreFrame->tree().traverseNext())
137-
coreFrame->editor().setIgnoreCompositionSelectionChange(enabled);
137+
coreFrame->editor().setIgnoreSelectionChanges(enabled);
138138
}
139139

140140
void FindController::willFindString()
141141
{
142-
setCompositionSelectionChangeEnabledInAllFrames(*m_webPage, true);
142+
setSelectionChangeUpdatesEnabledInAllFrames(*m_webPage, true);
143143
}
144144

145145
void FindController::didFindString()
@@ -157,12 +157,12 @@ static void setCompositionSelectionChangeEnabledInAllFrames(WebPage& page, bool
157157

158158
void FindController::didFailToFindString()
159159
{
160-
setCompositionSelectionChangeEnabledInAllFrames(*m_webPage, false);
160+
setSelectionChangeUpdatesEnabledInAllFrames(*m_webPage, false);
161161
}
162162

163163
void FindController::didHideFindIndicator()
164164
{
165-
setCompositionSelectionChangeEnabledInAllFrames(*m_webPage, false);
165+
setSelectionChangeUpdatesEnabledInAllFrames(*m_webPage, false);
166166
}
167167

168168
} // namespace WebKit

0 commit comments

Comments
 (0)