Diff
Modified: trunk/Source/WebKit/ChangeLog (258795 => 258796)
--- trunk/Source/WebKit/ChangeLog 2020-03-20 22:36:45 UTC (rev 258795)
+++ trunk/Source/WebKit/ChangeLog 2020-03-20 22:45:25 UTC (rev 258796)
@@ -1,5 +1,31 @@
2020-03-20 Daniel Bates <[email protected]>
+ Have insertDictatedTextAsync() take an InsertTextOptions
+ https://bugs.webkit.org/show_bug.cgi?id=209308
+ <rdar://problem/60652838>
+
+ Reviewed by Darin Adler.
+
+ This will provide future extensibility, which I plan to make use of in a subsequent patch,
+ in addition to making the interface for insertDictatedTextAsync() more like insertTextAsync().
+
+ * UIProcess/Cocoa/WebPageProxyCocoa.mm:
+ (WebKit::WebPageProxy::insertDictatedTextAsync): Pass the options through. The caller is now
+ responsible for setting the registerUndoGroup insertion option.
+ * UIProcess/Cocoa/WebViewImpl.mm:
+ (WebKit::WebViewImpl::insertText): Stack-allocate a InsertTextOptions setting its registerUndoGroup
+ field and pass this object through.
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView insertText:alternatives:style:]): Pass the default constructed InsertTextOptions,
+ which defaults registerUndoGroup to false to keep the current behavior.
+ * WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
+ (WebKit::WebPage::insertDictatedTextAsync): Write in terms of InsertTextOptions.registerUndoGroup.
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+
+2020-03-20 Daniel Bates <[email protected]>
+
Replace "deferred element focus" functionality with alternative solution
https://bugs.webkit.org/show_bug.cgi?id=201608
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (258795 => 258796)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm 2020-03-20 22:36:45 UTC (rev 258795)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm 2020-03-20 22:45:25 UTC (rev 258796)
@@ -232,7 +232,7 @@
process().send(Messages::WebPage::PerformDictionaryLookupOfCurrentSelection(), m_webPageID);
}
-void WebPageProxy::insertDictatedTextAsync(const String& text, const EditingRange& replacementRange, const Vector<TextAlternativeWithRange>& dictationAlternativesWithRange, bool registerUndoGroup)
+void WebPageProxy::insertDictatedTextAsync(const String& text, const EditingRange& replacementRange, const Vector<TextAlternativeWithRange>& dictationAlternativesWithRange, InsertTextOptions&& options)
{
#if USE(DICTATION_ALTERNATIVES)
if (!hasRunningProcess())
@@ -246,18 +246,12 @@
}
if (dictationAlternatives.isEmpty()) {
- InsertTextOptions options;
- options.registerUndoGroup = registerUndoGroup;
-
insertTextAsync(text, replacementRange, WTFMove(options));
return;
}
- process().send(Messages::WebPage::InsertDictatedTextAsync { text, replacementRange, dictationAlternatives, registerUndoGroup }, m_webPageID);
+ process().send(Messages::WebPage::InsertDictatedTextAsync { text, replacementRange, dictationAlternatives, WTFMove(options) }, m_webPageID);
#else
- InsertTextOptions options;
- options.registerUndoGroup = registerUndoGroup;
-
insertTextAsync(text, replacementRange, WTFMove(options));
#endif
}
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (258795 => 258796)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2020-03-20 22:36:45 UTC (rev 258795)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2020-03-20 22:45:25 UTC (rev 258796)
@@ -4844,11 +4844,13 @@
String eventText = text;
eventText.replace(NSBackTabCharacter, NSTabCharacter); // same thing is done in KeyEventMac.mm in WebCore
- if (!dictationAlternatives.isEmpty())
- m_page->insertDictatedTextAsync(eventText, replacementRange, dictationAlternatives, registerUndoGroup);
- else {
+ if (!dictationAlternatives.isEmpty()) {
InsertTextOptions options;
options.registerUndoGroup = registerUndoGroup;
+ m_page->insertDictatedTextAsync(eventText, replacementRange, dictationAlternatives, WTFMove(options));
+ } else {
+ InsertTextOptions options;
+ options.registerUndoGroup = registerUndoGroup;
options.editingRangeIsRelativeTo = m_isTextInsertionReplacingSoftSpace ? EditingRangeIsRelativeTo::Paragraph : EditingRangeIsRelativeTo::EditableRoot;
options.suppressSelectionUpdate = m_isTextInsertionReplacingSoftSpace;
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (258795 => 258796)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-03-20 22:36:45 UTC (rev 258795)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-03-20 22:45:25 UTC (rev 258796)
@@ -848,7 +848,7 @@
void setTextAsync(const String&);
void insertTextAsync(const String&, const EditingRange& replacementRange, InsertTextOptions&&);
- void insertDictatedTextAsync(const String&, const EditingRange& replacementRange, const Vector<WebCore::TextAlternativeWithRange>&, bool registerUndoGroup);
+ void insertDictatedTextAsync(const String&, const EditingRange& replacementRange, const Vector<WebCore::TextAlternativeWithRange>&, InsertTextOptions&&);
void hasMarkedText(CompletionHandler<void(bool)>&&);
void getMarkedRangeAsync(WTF::Function<void (EditingRange, CallbackBase::Error)>&&);
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (258795 => 258796)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2020-03-20 22:36:45 UTC (rev 258795)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2020-03-20 22:45:25 UTC (rev 258796)
@@ -4731,7 +4731,7 @@
BOOL isLowConfidence = style == UITextAlternativeStyleLowConfidence;
auto textAlternatives = adoptNS([[NSTextAlternatives alloc] initWithPrimaryString:aStringValue alternativeStrings:alternatives isLowConfidence:isLowConfidence]);
WebCore::TextAlternativeWithRange textAlternativeWithRange { textAlternatives.get(), NSMakeRange(0, aStringValue.length) };
- _page->insertDictatedTextAsync(aStringValue, WebKit::EditingRange { }, { textAlternativeWithRange }, false /* registerUndoGroup */);
+ _page->insertDictatedTextAsync(aStringValue, { }, { textAlternativeWithRange }, { });
}
}
Modified: trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm (258795 => 258796)
--- trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm 2020-03-20 22:36:45 UTC (rev 258795)
+++ trunk/Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm 2020-03-20 22:45:25 UTC (rev 258796)
@@ -27,6 +27,7 @@
#import "WebPage.h"
#import "AttributedString.h"
+#import "InsertTextOptions.h"
#import "LoadParameters.h"
#import "PluginView.h"
#import "WKAccessibilityWebPageObjectBase.h"
@@ -182,7 +183,7 @@
return dictionaryPopupInfo;
}
-void WebPage::insertDictatedTextAsync(const String& text, const EditingRange& replacementEditingRange, const Vector<WebCore::DictationAlternative>& dictationAlternativeLocations, bool registerUndoGroup)
+void WebPage::insertDictatedTextAsync(const String& text, const EditingRange& replacementEditingRange, const Vector<WebCore::DictationAlternative>& dictationAlternativeLocations, InsertTextOptions&& options)
{
auto& frame = m_page->focusController().focusedOrMainFrame();
Ref<Frame> protector { frame };
@@ -193,7 +194,7 @@
frame.selection().setSelection(VisibleSelection { *replacementRange, SEL_DEFAULT_AFFINITY });
}
- if (registerUndoGroup)
+ if (options.registerUndoGroup)
send(Messages::WebPageProxy::RegisterInsertionUndoGrouping { });
ASSERT(!frame.editor().hasComposition());
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (258795 => 258796)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2020-03-20 22:36:45 UTC (rev 258795)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2020-03-20 22:45:25 UTC (rev 258796)
@@ -846,7 +846,7 @@
void acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent&, CompletionHandler<void(bool)>&&);
bool performNonEditingBehaviorForSelector(const String&, WebCore::KeyboardEvent*);
- void insertDictatedTextAsync(const String& text, const EditingRange& replacementRange, const Vector<WebCore::DictationAlternative>& dictationAlternativeLocations, bool registerUndoGroup = false);
+ void insertDictatedTextAsync(const String& text, const EditingRange& replacementRange, const Vector<WebCore::DictationAlternative>& dictationAlternativeLocations, InsertTextOptions&&);
#endif
#if PLATFORM(MAC)
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (258795 => 258796)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2020-03-20 22:36:45 UTC (rev 258795)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in 2020-03-20 22:45:25 UTC (rev 258796)
@@ -442,7 +442,7 @@
SetTextAsync(String text)
InsertTextAsync(String text, struct WebKit::EditingRange replacementRange, struct WebKit::InsertTextOptions options)
- InsertDictatedTextAsync(String text, struct WebKit::EditingRange replacementRange, Vector<WebCore::DictationAlternative> dictationAlternatives, bool registerUndoGroup)
+ InsertDictatedTextAsync(String text, struct WebKit::EditingRange replacementRange, Vector<WebCore::DictationAlternative> dictationAlternatives, struct WebKit::InsertTextOptions options)
HasMarkedText() -> (bool hasMarkedText) Async
GetMarkedRangeAsync(WebKit::CallbackID callbackID)