Diff
Modified: trunk/Source/WebCore/ChangeLog (213901 => 213902)
--- trunk/Source/WebCore/ChangeLog 2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebCore/ChangeLog 2017-03-14 17:01:40 UTC (rev 213902)
@@ -1,3 +1,39 @@
+2017-03-14 Wenson Hsieh <[email protected]>
+
+ [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.
+
+ 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):
+
2017-03-14 Antoine Quint <[email protected]>
[Modern Media Controls] iOS may attempt to load fullscreen icon variants
Modified: trunk/Source/WebCore/editing/Editor.cpp (213901 => 213902)
--- trunk/Source/WebCore/editing/Editor.cpp 2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebCore/editing/Editor.cpp 2017-03-14 17:01:40 UTC (rev 213902)
@@ -1683,7 +1683,7 @@
{
unsigned start;
unsigned end;
- if (!hasComposition() || ignoreCompositionSelectionChange() || getCompositionSelection(start, end))
+ if (!hasComposition() || ignoreSelectionChanges() || getCompositionSelection(start, end))
return false;
cancelComposition();
@@ -1700,7 +1700,7 @@
ASSERT(mode == ConfirmComposition || mode == CancelComposition);
UserTypingGestureIndicator typingGestureIndicator(m_frame);
- setIgnoreCompositionSelectionChange(true);
+ setIgnoreSelectionChanges(true);
if (mode == CancelComposition)
ASSERT(text == emptyString());
@@ -1711,7 +1711,7 @@
m_customCompositionUnderlines.clear();
if (m_frame.selection().isNone()) {
- setIgnoreCompositionSelectionChange(false);
+ setIgnoreSelectionChanges(false);
return;
}
@@ -1731,7 +1731,7 @@
TypingCommand::closeTyping(&m_frame);
}
- setIgnoreCompositionSelectionChange(false);
+ setIgnoreSelectionChanges(false);
}
void Editor::setComposition(const String& text, const Vector<CompositionUnderline>& underlines, unsigned selectionStart, unsigned selectionEnd)
@@ -1740,7 +1740,7 @@
UserTypingGestureIndicator typingGestureIndicator(m_frame);
- setIgnoreCompositionSelectionChange(true);
+ setIgnoreSelectionChanges(true);
// Updates styles before setting selection for composition to prevent
// inserting the previous composition text into text nodes oddly.
@@ -1750,7 +1750,7 @@
selectComposition();
if (m_frame.selection().isNone()) {
- setIgnoreCompositionSelectionChange(false);
+ setIgnoreSelectionChanges(false);
return;
}
@@ -1843,7 +1843,7 @@
}
}
- setIgnoreCompositionSelectionChange(false);
+ setIgnoreSelectionChanges(false);
#if PLATFORM(IOS)
client()->stopDelayingAndCoalescingContentChangeNotifications();
@@ -2775,7 +2775,7 @@
void Editor::revealSelectionAfterEditingOperation(const ScrollAlignment& alignment, RevealExtentOption revealExtentOption)
{
- if (m_ignoreCompositionSelectionChange)
+ if (m_ignoreSelectionChanges)
return;
#if PLATFORM(IOS)
@@ -2787,12 +2787,12 @@
m_frame.selection().revealSelection(revealMode, alignment, revealExtentOption);
}
-void Editor::setIgnoreCompositionSelectionChange(bool ignore, RevealSelection shouldRevealExistingSelection)
+void Editor::setIgnoreSelectionChanges(bool ignore, RevealSelection shouldRevealExistingSelection)
{
- if (m_ignoreCompositionSelectionChange == ignore)
+ if (m_ignoreSelectionChanges == ignore)
return;
- m_ignoreCompositionSelectionChange = ignore;
+ m_ignoreSelectionChanges = ignore;
#if PLATFORM(IOS)
// FIXME: Should suppress selection change notifications during a composition change <https://webkit.org/b/38830>
if (!ignore)
@@ -2944,7 +2944,7 @@
// starts a new kill ring sequence, but we want to do these things (matches AppKit).
#if PLATFORM(IOS)
// FIXME: Should suppress selection change notifications during a composition change <https://webkit.org/b/38830>
- if (m_ignoreCompositionSelectionChange)
+ if (m_ignoreSelectionChanges)
return;
#endif
if (selectionDidNotChangeDOMPosition && client())
@@ -3286,7 +3286,7 @@
{
#if PLATFORM(IOS)
// FIXME: Should suppress selection change notifications during a composition change <https://webkit.org/b/38830>
- if (m_ignoreCompositionSelectionChange)
+ if (m_ignoreSelectionChanges)
return;
#endif
Modified: trunk/Source/WebCore/editing/Editor.h (213901 => 213902)
--- trunk/Source/WebCore/editing/Editor.h 2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebCore/editing/Editor.h 2017-03-14 17:01:40 UTC (rev 213902)
@@ -334,8 +334,8 @@
const Vector<CompositionUnderline>& customCompositionUnderlines() const { return m_customCompositionUnderlines; }
enum class RevealSelection { No, Yes };
- WEBCORE_EXPORT void setIgnoreCompositionSelectionChange(bool, RevealSelection shouldRevealExistingSelection = RevealSelection::Yes);
- bool ignoreCompositionSelectionChange() const { return m_ignoreCompositionSelectionChange; }
+ WEBCORE_EXPORT void setIgnoreSelectionChanges(bool, RevealSelection shouldRevealExistingSelection = RevealSelection::Yes);
+ bool ignoreSelectionChanges() const { return m_ignoreSelectionChanges; }
WEBCORE_EXPORT PassRefPtr<Range> rangeForPoint(const IntPoint& windowPoint);
@@ -544,7 +544,7 @@
unsigned m_compositionStart;
unsigned m_compositionEnd;
Vector<CompositionUnderline> m_customCompositionUnderlines;
- bool m_ignoreCompositionSelectionChange { false };
+ bool m_ignoreSelectionChanges { false };
bool m_shouldStartNewKillRingSequence { false };
bool m_shouldStyleWithCSS { false };
const std::unique_ptr<KillRing> m_killRing;
Modified: trunk/Source/WebCore/editing/mac/EditorMac.mm (213901 => 213902)
--- trunk/Source/WebCore/editing/mac/EditorMac.mm 2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebCore/editing/mac/EditorMac.mm 2017-03-14 17:01:40 UTC (rev 213902)
@@ -258,7 +258,7 @@
void Editor::selectionWillChange()
{
- if (!hasComposition() || ignoreCompositionSelectionChange() || m_frame.selection().isNone())
+ if (!hasComposition() || ignoreSelectionChanges() || m_frame.selection().isNone())
return;
cancelComposition();
Modified: trunk/Source/WebCore/page/TextIndicator.cpp (213901 => 213902)
--- trunk/Source/WebCore/page/TextIndicator.cpp 2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebCore/page/TextIndicator.cpp 2017-03-14 17:01:40 UTC (rev 213902)
@@ -71,7 +71,7 @@
Ref<Frame> protector(*frame);
#if PLATFORM(IOS)
- frame->editor().setIgnoreCompositionSelectionChange(true);
+ frame->editor().setIgnoreSelectionChanges(true);
frame->selection().setUpdateAppearanceEnabled(true);
#endif
@@ -93,7 +93,7 @@
frame->selection().setSelection(oldSelection);
#if PLATFORM(IOS)
- frame->editor().setIgnoreCompositionSelectionChange(false, Editor::RevealSelection::No);
+ frame->editor().setIgnoreSelectionChanges(false, Editor::RevealSelection::No);
frame->selection().setUpdateAppearanceEnabled(false);
#endif
Modified: trunk/Source/WebKit/mac/ChangeLog (213901 => 213902)
--- trunk/Source/WebKit/mac/ChangeLog 2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit/mac/ChangeLog 2017-03-14 17:01:40 UTC (rev 213902)
@@ -1,3 +1,18 @@
+2017-03-14 Wenson Hsieh <[email protected]>
+
+ [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.
+
+ Renames setIgnoreCompositionSelectionChange to setIgnoreSelectionChanges. See WebCore ChangeLog for more details.
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView _updateSelectionForInputManager]):
+ * WebView/WebView.mm:
+ (-[WebView updateTextTouchBar]):
+
2017-03-13 Anders Carlsson <[email protected]>
Fix build warnings.
Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (213901 => 213902)
--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm 2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm 2017-03-14 17:01:40 UTC (rev 213902)
@@ -7211,7 +7211,7 @@
[self _updateSecureInputState];
- if (!coreFrame->editor().hasComposition() || coreFrame->editor().ignoreCompositionSelectionChange())
+ if (!coreFrame->editor().hasComposition() || coreFrame->editor().ignoreSelectionChanges())
return;
unsigned start;
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (213901 => 213902)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2017-03-14 17:01:40 UTC (rev 213902)
@@ -9616,7 +9616,7 @@
}
if ([NSSpellChecker isAutomaticTextCompletionEnabled] && !_private->_isCustomizingTouchBar) {
- BOOL shouldShowCandidateList = !coreFrame->selection().selection().isRange() || coreFrame->editor().ignoreCompositionSelectionChange();
+ BOOL shouldShowCandidateList = !coreFrame->selection().selection().isRange() || coreFrame->editor().ignoreSelectionChanges();
[self.candidateList updateWithInsertionPointVisibility:shouldShowCandidateList];
}
Modified: trunk/Source/WebKit2/ChangeLog (213901 => 213902)
--- trunk/Source/WebKit2/ChangeLog 2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit2/ChangeLog 2017-03-14 17:01:40 UTC (rev 213902)
@@ -1,3 +1,38 @@
+2017-03-14 Wenson Hsieh <[email protected]>
+
+ [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.
+
+ 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):
+
2017-03-14 Carlos Garcia Campos <[email protected]>
Unreviewed. Fix syntax error in GTK+ API docs.
Modified: trunk/Source/WebKit2/Shared/EditorState.cpp (213901 => 213902)
--- trunk/Source/WebKit2/Shared/EditorState.cpp 2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit2/Shared/EditorState.cpp 2017-03-14 17:01:40 UTC (rev 213902)
@@ -32,7 +32,7 @@
void EditorState::encode(IPC::Encoder& encoder) const
{
- encoder << shouldIgnoreCompositionSelectionChange;
+ encoder << shouldIgnoreSelectionChanges;
encoder << selectionIsNone;
encoder << selectionIsRange;
encoder << isContentEditable;
@@ -56,7 +56,7 @@
bool EditorState::decode(IPC::Decoder& decoder, EditorState& result)
{
- if (!decoder.decode(result.shouldIgnoreCompositionSelectionChange))
+ if (!decoder.decode(result.shouldIgnoreSelectionChanges))
return false;
if (!decoder.decode(result.selectionIsNone))
Modified: trunk/Source/WebKit2/Shared/EditorState.h (213901 => 213902)
--- trunk/Source/WebKit2/Shared/EditorState.h 2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit2/Shared/EditorState.h 2017-03-14 17:01:40 UTC (rev 213902)
@@ -60,7 +60,7 @@
};
struct EditorState {
- bool shouldIgnoreCompositionSelectionChange { false };
+ bool shouldIgnoreSelectionChanges { false };
bool selectionIsNone { true }; // This will be false when there is a caret selection.
bool selectionIsRange { false };
Modified: trunk/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp (213901 => 213902)
--- trunk/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp 2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp 2017-03-14 17:01:40 UTC (rev 213902)
@@ -79,7 +79,7 @@
{
m_editorState = editorState;
- if (editorState.shouldIgnoreCompositionSelectionChange)
+ if (editorState.shouldIgnoreSelectionChanges)
return;
if (m_editorState.selectionIsRange)
WebPasteboardProxy::singleton().setPrimarySelectionOwner(focusedFrame());
Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (213901 => 213902)
--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm 2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm 2017-03-14 17:01:40 UTC (rev 213902)
@@ -1085,7 +1085,7 @@
if (couldChangeSecureInputState && !editorState.selectionIsNone)
m_pageClient.updateSecureInputState();
- if (editorState.shouldIgnoreCompositionSelectionChange)
+ if (editorState.shouldIgnoreSelectionChanges)
return;
// We always need to notify the client on iOS to make sure the selection is redrawn,
Modified: trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (213901 => 213902)
--- trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm 2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm 2017-03-14 17:01:40 UTC (rev 213902)
@@ -574,7 +574,7 @@
if (couldChangeSecureInputState && !editorState.selectionIsNone)
m_pageClient.updateSecureInputState();
- if (editorState.shouldIgnoreCompositionSelectionChange)
+ if (editorState.shouldIgnoreSelectionChanges)
return;
m_pageClient.selectionDidChange();
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (213901 => 213902)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2017-03-14 17:01:40 UTC (rev 213902)
@@ -831,7 +831,7 @@
result.isContentRichlyEditable = selection.isContentRichlyEditable();
result.isInPasswordField = selection.isInPasswordField();
result.hasComposition = frame.editor().hasComposition();
- result.shouldIgnoreCompositionSelectionChange = frame.editor().ignoreCompositionSelectionChange();
+ result.shouldIgnoreSelectionChanges = frame.editor().ignoreSelectionChanges();
#if PLATFORM(COCOA)
if (shouldIncludePostLayoutData == IncludePostLayoutDataHint::Yes && result.isContentEditable) {
@@ -3525,7 +3525,10 @@
m_pendingDropExtensionsForFileUpload.append(extension);
}
+ auto& frame = m_page->focusController().focusedOrMainFrame();
+ frame.editor().setIgnoreSelectionChanges(true);
m_page->dragController().performDragOperation(dragData);
+ frame.editor().setIgnoreSelectionChanges(false);
// If we started loading a local file, the sandbox extension tracker would have adopted this
// pending drop sandbox extension. If not, we'll play it safe and clear it.
@@ -4861,9 +4864,9 @@
Element* scope = targetFrame->selection().selection().rootEditableElement();
RefPtr<Range> replacementRange = TextIterator::rangeFromLocationAndLength(scope, replacementStart, replacementLength);
- targetFrame->editor().setIgnoreCompositionSelectionChange(true);
+ targetFrame->editor().setIgnoreSelectionChanges(true);
targetFrame->selection().setSelection(VisibleSelection(*replacementRange, SEL_DEFAULT_AFFINITY));
- targetFrame->editor().setIgnoreCompositionSelectionChange(false);
+ targetFrame->editor().setIgnoreSelectionChanges(false);
}
targetFrame->editor().setComposition(text, underlines, selectionStart, selectionStart + selectionLength);
@@ -4957,7 +4960,7 @@
// FIXME: This logic should be in WebCore.
// 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.
// FIXME: We can't cancel composition when selection changes to NoSelection, but we probably should.
- if (frame.editor().hasComposition() && !frame.editor().ignoreCompositionSelectionChange() && !frame.selection().isNone()) {
+ if (frame.editor().hasComposition() && !frame.editor().ignoreSelectionChanges() && !frame.selection().isNone()) {
frame.editor().cancelComposition();
discardedComposition();
} else
Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/FindControllerIOS.mm (213901 => 213902)
--- trunk/Source/WebKit2/WebProcess/WebPage/ios/FindControllerIOS.mm 2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/FindControllerIOS.mm 2017-03-14 17:01:40 UTC (rev 213902)
@@ -131,15 +131,15 @@
didHideFindIndicator();
}
-static void setCompositionSelectionChangeEnabledInAllFrames(WebPage& page, bool enabled)
+static void setSelectionChangeUpdatesEnabledInAllFrames(WebPage& page, bool enabled)
{
for (Frame* coreFrame = page.mainFrame(); coreFrame; coreFrame = coreFrame->tree().traverseNext())
- coreFrame->editor().setIgnoreCompositionSelectionChange(enabled);
+ coreFrame->editor().setIgnoreSelectionChanges(enabled);
}
void FindController::willFindString()
{
- setCompositionSelectionChangeEnabledInAllFrames(*m_webPage, true);
+ setSelectionChangeUpdatesEnabledInAllFrames(*m_webPage, true);
}
void FindController::didFindString()
@@ -157,12 +157,12 @@
void FindController::didFailToFindString()
{
- setCompositionSelectionChangeEnabledInAllFrames(*m_webPage, false);
+ setSelectionChangeUpdatesEnabledInAllFrames(*m_webPage, false);
}
void FindController::didHideFindIndicator()
{
- setCompositionSelectionChangeEnabledInAllFrames(*m_webPage, false);
+ setSelectionChangeUpdatesEnabledInAllFrames(*m_webPage, false);
}
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (213901 => 213902)
--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2017-03-14 17:01:40 UTC (rev 213902)
@@ -534,7 +534,7 @@
void WebPage::updateSelectionAppearance()
{
Frame& frame = m_page->focusController().focusedOrMainFrame();
- if (!frame.editor().ignoreCompositionSelectionChange() && (frame.editor().hasComposition() || !frame.selection().selection().isNone()))
+ if (!frame.editor().ignoreSelectionChanges() && (frame.editor().hasComposition() || !frame.selection().selection().isNone()))
didChangeSelection();
}
@@ -2156,10 +2156,10 @@
if (plainTextReplacingNoBreakSpace(wordRange.get()) != oldText)
return;
- frame.editor().setIgnoreCompositionSelectionChange(true);
+ frame.editor().setIgnoreSelectionChanges(true);
frame.selection().setSelectedRange(wordRange.get(), UPSTREAM, true);
frame.editor().insertText(newText, 0);
- frame.editor().setIgnoreCompositionSelectionChange(false);
+ frame.editor().setIgnoreSelectionChanges(false);
}
void WebPage::replaceDictatedText(const String& oldText, const String& newText)
@@ -2183,10 +2183,10 @@
return;
// We don't want to notify the client that the selection has changed until we are done inserting the new text.
- frame.editor().setIgnoreCompositionSelectionChange(true);
+ frame.editor().setIgnoreSelectionChanges(true);
frame.selection().setSelectedRange(range.get(), UPSTREAM, true);
frame.editor().insertText(newText, 0);
- frame.editor().setIgnoreCompositionSelectionChange(false);
+ frame.editor().setIgnoreSelectionChanges(false);
}
void WebPage::requestAutocorrectionData(const String& textForAutocorrection, uint64_t callbackID)
Modified: trunk/Tools/ChangeLog (213901 => 213902)
--- trunk/Tools/ChangeLog 2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Tools/ChangeLog 2017-03-14 17:01:40 UTC (rev 213902)
@@ -1,3 +1,20 @@
+2017-03-14 Wenson Hsieh <[email protected]>
+
+ [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.
+
+ 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]):
+
2017-03-13 Brady Eidson <[email protected]>
REGRESSION (r213877): WebKit2.CookieManager fails.
Modified: trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm (213901 => 213902)
--- trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm 2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm 2017-03-14 17:01:40 UTC (rev 213902)
@@ -25,7 +25,7 @@
#include "config.h"
-#if 0
+#if ENABLE(DATA_INTERACTION)
#import "DataInteractionSimulator.h"
#import "PlatformUtilities.h"
@@ -251,33 +251,6 @@
EXPECT_TRUE([[dataInteractionSimulator finalSelectionRects] isEqualToArray:@[ makeCGRectValue(1, 201, 215, 174) ]]);
}
-TEST(DataInteractionTests, AttachmentElementItemProviders)
-{
- RetainPtr<WKWebViewConfiguration> configuration = [WKWebViewConfiguration testwebkitapi_configurationWithTestPlugInClassName:@"BundleEditingDelegatePlugIn"];
- [configuration _setAttachmentElementEnabled:YES];
- auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500) configuration:configuration.get()]);
- auto dataInteractionSimulator = adoptNS([[DataInteractionSimulator alloc] initWithWebView:webView.get()]);
- [webView synchronouslyLoadTestPageNamed:@"attachment-element"];
-
- NSString *injectedTypeIdentifier = @"org.webkit.data";
- __block RetainPtr<NSString> injectedString;
- [dataInteractionSimulator setConvertItemProvidersBlock:^NSArray *(NSArray *originalItemProviders)
- {
- for (UIItemProvider *provider in originalItemProviders) {
- NSData *injectedData = [provider copyDataRepresentationForTypeIdentifier:injectedTypeIdentifier error:nil];
- if (!injectedData.length)
- continue;
- injectedString = adoptNS([[NSString alloc] initWithData:injectedData encoding:NSUTF8StringEncoding]);
- break;
- }
- return originalItemProviders;
- }];
-
- [dataInteractionSimulator runFrom:CGPointMake(50, 50) to:CGPointMake(50, 400)];
-
- EXPECT_WK_STREQ("hello", [injectedString UTF8String]);
-}
-
} // namespace TestWebKitAPI
#endif // ENABLE(DATA_INTERACTION)
Modified: trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.h (213901 => 213902)
--- trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.h 2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.h 2017-03-14 17:01:40 UTC (rev 213902)
@@ -23,7 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if 0
+#if ENABLE(DATA_INTERACTION)
#import "TestWKWebView.h"
#import <UIKit/UIItemProvider.h>
@@ -32,7 +32,7 @@
#import <WebKit/_WKTestingDelegate.h>
#import <wtf/BlockPtr.h>
-@class MockDataInteractionInfo;
+@class MockDataOperationSession;
@class MockDataInteractionSession;
extern NSString * const DataInteractionEnterEventName;
@@ -52,7 +52,7 @@
@interface DataInteractionSimulator : NSObject<_WKTestingDelegate, WKUIDelegatePrivate> {
RetainPtr<TestWKWebView> _webView;
RetainPtr<MockDataInteractionSession> _dataInteractionSession;
- RetainPtr<MockDataInteractionInfo> _dataInteractionInfo;
+ RetainPtr<MockDataOperationSession> _dataOperationSession;
RetainPtr<NSMutableArray> _observedEventNames;
RetainPtr<UIItemProvider> _externalItemProvider;
RetainPtr<NSArray *> _finalSelectionRects;
Modified: trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.mm (213901 => 213902)
--- trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.mm 2017-03-14 16:59:37 UTC (rev 213901)
+++ trunk/Tools/TestWebKitAPI/ios/DataInteractionSimulator.mm 2017-03-14 17:01:40 UTC (rev 213902)
@@ -26,7 +26,7 @@
#include "config.h"
#include "DataInteractionSimulator.h"
-#if 0
+#if ENABLE(DATA_INTERACTION)
#import "PlatformUtilities.h"
#import <UIKit/UIItemProvider_Private.h>
@@ -83,7 +83,7 @@
_observedEventNames = adoptNS([[NSMutableArray alloc] init]);
_finalSelectionRects = @[ ];
_dataInteractionSession = nil;
- _dataInteractionInfo = nil;
+ _dataOperationSession = nil;
}
- (NSArray *)observedEventNames
@@ -107,7 +107,7 @@
_endLocation = endLocation;
if (self.externalItemProvider) {
- _dataInteractionInfo = adoptNS([[MockDataInteractionInfo alloc] initWithProvider:self.externalItemProvider location:_startLocation window:[_webView window]]);
+ _dataOperationSession = adoptNS([[MockDataOperationSession alloc] initWithProvider:self.externalItemProvider location:_startLocation window:[_webView window]]);
_phase = DataInteractionBegan;
[self _advanceProgress];
} else {
@@ -135,11 +135,11 @@
_currentProgress += progressIncrementStep;
CGPoint locationInWindow = self._currentLocation;
[_dataInteractionSession setMockLocationInWindow:locationInWindow];
- [_dataInteractionInfo setMockLocationInWindow:locationInWindow];
+ [_dataOperationSession setMockLocationInWindow:locationInWindow];
if (_currentProgress >= 1) {
- [_webView _simulateDataInteractionPerformOperation:_dataInteractionInfo.get()];
- [_webView _simulateDataInteractionEnded:_dataInteractionInfo.get()];
+ [_webView _simulateDataInteractionPerformOperation:_dataOperationSession.get()];
+ [_webView _simulateDataInteractionEnded:_dataOperationSession.get()];
if (_dataInteractionSession)
[_webView _simulateDataInteractionSessionDidEnd:_dataInteractionSession.get()];
@@ -164,7 +164,7 @@
[itemProviders addObject:item.itemProvider];
#endif
- _dataInteractionInfo = adoptNS([[MockDataInteractionInfo alloc] initWithProvider:itemProviders.firstObject location:self._currentLocation window:[_webView window]]);
+ _dataOperationSession = adoptNS([[MockDataOperationSession alloc] initWithProvider:itemProviders.firstObject location:self._currentLocation window:[_webView window]]);
#if HAS_DATA_INTERACTION_ITEMS
[_dataInteractionSession setItems:items];
#endif
@@ -173,11 +173,11 @@
break;
}
case DataInteractionBegan:
- [_webView _simulateDataInteractionEntered:_dataInteractionInfo.get()];
+ [_webView _simulateDataInteractionEntered:_dataOperationSession.get()];
_phase = DataInteractionEntered;
break;
case DataInteractionEntered:
- [_webView _simulateDataInteractionUpdated:_dataInteractionInfo.get()];
+ [_webView _simulateDataInteractionUpdated:_dataOperationSession.get()];
break;
default:
break;