Title: [245073] trunk/Source/WebKit
Revision
245073
Author
[email protected]
Date
2019-05-08 15:48:31 -0700 (Wed, 08 May 2019)

Log Message

Pass insertTextAsync options as a struct
https://bugs.webkit.org/show_bug.cgi?id=197710

Reviewed by Brent Fulgham.

WebPageProxy::insertTextAsync() is becoming unwieldy to work with given the large number of
optional arguments that can be passed to it. Let's pass a struct instead.

* Shared/Cocoa/InsertTextOptions.cpp: Added.
(IPC::ArgumentCoder<WebKit::InsertTextOptions>::encode):
(IPC::ArgumentCoder<WebKit::InsertTextOptions>::decode):
* Shared/Cocoa/InsertTextOptions.h: Added.
* Shared/EditingRange.h: Add EnumTrait so that we can encode the EditingRangeIsRelativeTo
enumeration.
* SourcesCocoa.txt: Add a new file.
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::insertText): Update code now that we pass a struct.
(WebKit::WebViewImpl::setMarkedText): Ditto.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::insertTextAsync): Ditto.
* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView insertText:]): Ditto.
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::insertDictatedTextAsync): Ditto.
* WebKit.xcodeproj/project.pbxproj: Add new files.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::insertTextAsync): Ditto.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in: Ditto.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (245072 => 245073)


--- trunk/Source/WebKit/ChangeLog	2019-05-08 22:24:56 UTC (rev 245072)
+++ trunk/Source/WebKit/ChangeLog	2019-05-08 22:48:31 UTC (rev 245073)
@@ -1,3 +1,36 @@
+2019-05-08  Daniel Bates  <[email protected]>
+
+        Pass insertTextAsync options as a struct
+        https://bugs.webkit.org/show_bug.cgi?id=197710
+
+        Reviewed by Brent Fulgham.
+
+        WebPageProxy::insertTextAsync() is becoming unwieldy to work with given the large number of
+        optional arguments that can be passed to it. Let's pass a struct instead.
+
+        * Shared/Cocoa/InsertTextOptions.cpp: Added.
+        (IPC::ArgumentCoder<WebKit::InsertTextOptions>::encode):
+        (IPC::ArgumentCoder<WebKit::InsertTextOptions>::decode):
+        * Shared/Cocoa/InsertTextOptions.h: Added.
+        * Shared/EditingRange.h: Add EnumTrait so that we can encode the EditingRangeIsRelativeTo
+        enumeration.
+        * SourcesCocoa.txt: Add a new file.
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::insertText): Update code now that we pass a struct.
+        (WebKit::WebViewImpl::setMarkedText): Ditto.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::insertTextAsync): Ditto.
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView insertText:]): Ditto.
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::WebPageProxy::insertDictatedTextAsync): Ditto.
+        * WebKit.xcodeproj/project.pbxproj: Add new files.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::insertTextAsync): Ditto.
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in: Ditto.
+
 2019-05-08  Timothy Hatcher  <[email protected]>
 
         Add plumbing for inactive system colors in RenderTheme cache.

Added: trunk/Source/WebKit/Shared/Cocoa/InsertTextOptions.cpp (0 => 245073)


--- trunk/Source/WebKit/Shared/Cocoa/InsertTextOptions.cpp	                        (rev 0)
+++ trunk/Source/WebKit/Shared/Cocoa/InsertTextOptions.cpp	2019-05-08 22:48:31 UTC (rev 245073)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "InsertTextOptions.h"
+
+namespace IPC {
+
+void ArgumentCoder<WebKit::InsertTextOptions>::encode(Encoder& encoder, const WebKit::InsertTextOptions& options)
+{
+    encoder << options.registerUndoGroup;
+    encoder << options.suppressSelectionUpdate;
+    encoder << options.editingRangeIsRelativeTo;
+}
+
+Optional<WebKit::InsertTextOptions> ArgumentCoder<WebKit::InsertTextOptions>::decode(Decoder& decoder)
+{
+    WebKit::InsertTextOptions options;
+    if (!decoder.decode(options.registerUndoGroup))
+        return WTF::nullopt;
+    if (!decoder.decode(options.suppressSelectionUpdate))
+        return WTF::nullopt;
+    if (!decoder.decode(options.editingRangeIsRelativeTo))
+        return WTF::nullopt;
+    return options;
+}
+
+} // namespace IPC

Added: trunk/Source/WebKit/Shared/Cocoa/InsertTextOptions.h (0 => 245073)


--- trunk/Source/WebKit/Shared/Cocoa/InsertTextOptions.h	                        (rev 0)
+++ trunk/Source/WebKit/Shared/Cocoa/InsertTextOptions.h	2019-05-08 22:48:31 UTC (rev 245073)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "ArgumentCoders.h"
+#include "EditingRange.h"
+
+namespace WebKit {
+
+struct InsertTextOptions {
+    bool registerUndoGroup { false };
+    bool suppressSelectionUpdate { false };
+    EditingRangeIsRelativeTo editingRangeIsRelativeTo { EditingRangeIsRelativeTo::EditableRoot };
+};
+
+} // namespace WebKit
+
+namespace IPC {
+template<> struct ArgumentCoder<WebKit::InsertTextOptions> {
+    static void encode(Encoder&, const WebKit::InsertTextOptions&);
+    static Optional<WebKit::InsertTextOptions> decode(Decoder&);
+};
+}

Modified: trunk/Source/WebKit/Shared/EditingRange.h (245072 => 245073)


--- trunk/Source/WebKit/Shared/EditingRange.h	2019-05-08 22:24:56 UTC (rev 245072)
+++ trunk/Source/WebKit/Shared/EditingRange.h	2019-05-08 22:48:31 UTC (rev 245073)
@@ -26,6 +26,7 @@
 #pragma once
 
 #include "ArgumentCoders.h"
+#include <wtf/EnumTraits.h>
 #include <wtf/RefPtr.h>
 
 namespace WebCore {
@@ -91,3 +92,9 @@
     static Optional<WebKit::EditingRange> decode(Decoder&);
 };
 }
+
+namespace WTF {
+template<> struct EnumTraits<WebKit::EditingRangeIsRelativeTo> {
+    using values = EnumValues<WebKit::EditingRangeIsRelativeTo, WebKit::EditingRangeIsRelativeTo::EditableRoot, WebKit::EditingRangeIsRelativeTo::Paragraph>;
+};
+}

Modified: trunk/Source/WebKit/SourcesCocoa.txt (245072 => 245073)


--- trunk/Source/WebKit/SourcesCocoa.txt	2019-05-08 22:24:56 UTC (rev 245072)
+++ trunk/Source/WebKit/SourcesCocoa.txt	2019-05-08 22:48:31 UTC (rev 245073)
@@ -141,6 +141,7 @@
 Shared/Cocoa/AuxiliaryProcessCocoa.mm
 Shared/Cocoa/CompletionHandlerCallChecker.mm
 Shared/Cocoa/DataDetectionResult.mm
+Shared/Cocoa/InsertTextOptions.cpp
 Shared/Cocoa/LoadParametersCocoa.mm
 Shared/Cocoa/SandboxExtensionCocoa.mm
 Shared/Cocoa/SandboxInitialiationParametersCocoa.mm

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (245072 => 245073)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2019-05-08 22:24:56 UTC (rev 245072)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2019-05-08 22:48:31 UTC (rev 245073)
@@ -36,6 +36,7 @@
 #import "ColorSpaceData.h"
 #import "FullscreenClient.h"
 #import "GenericCallback.h"
+#import "InsertTextOptions.h"
 #import "Logging.h"
 #import "NativeWebGestureEvent.h"
 #import "NativeWebKeyboardEvent.h"
@@ -4759,8 +4760,14 @@
     eventText.replace(NSBackTabCharacter, NSTabCharacter); // same thing is done in KeyEventMac.mm in WebCore
     if (!dictationAlternatives.isEmpty())
         m_page->insertDictatedTextAsync(eventText, replacementRange, dictationAlternatives, registerUndoGroup);
-    else
-        m_page->insertTextAsync(eventText, replacementRange, registerUndoGroup, m_isTextInsertionReplacingSoftSpace ? EditingRangeIsRelativeTo::Paragraph : EditingRangeIsRelativeTo::EditableRoot, m_isTextInsertionReplacingSoftSpace);
+    else {
+        InsertTextOptions options;
+        options.registerUndoGroup = registerUndoGroup;
+        options.editingRangeIsRelativeTo = m_isTextInsertionReplacingSoftSpace ? EditingRangeIsRelativeTo::Paragraph : EditingRangeIsRelativeTo::EditableRoot;
+        options.suppressSelectionUpdate = m_isTextInsertionReplacingSoftSpace;
+
+        m_page->insertTextAsync(eventText, replacementRange, WTFMove(options));
+    }
 }
 
 void WebViewImpl::selectedRangeWithCompletionHandler(void(^completionHandlerPtr)(NSRange selectedRange))
@@ -4957,7 +4964,7 @@
         notifyInputContextAboutDiscardedComposition();
         // FIXME: We should store the command to handle it after DOM event processing, as it's regular keyboard input now, not a composition.
         if ([text length] == 1 && isASCII([text characterAtIndex:0]))
-            m_page->insertTextAsync(text, replacementRange);
+            m_page->insertTextAsync(text, replacementRange, { });
         else
             NSBeep();
         return;

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (245072 => 245073)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-05-08 22:24:56 UTC (rev 245072)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-05-08 22:48:31 UTC (rev 245073)
@@ -188,6 +188,7 @@
 
 #if PLATFORM(COCOA)
 #include "AttributedString.h"
+#include "InsertTextOptions.h"
 #include "RemoteLayerTreeDrawingAreaProxy.h"
 #include "RemoteLayerTreeScrollingPerformanceData.h"
 #include "TouchBarMenuData.h"
@@ -7912,12 +7913,12 @@
         process().send(Messages::WebPage::SetTextAsync(text), m_pageID);
 }
 
-void WebPageProxy::insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup, EditingRangeIsRelativeTo editingRangeIsRelativeTo, bool suppressSelectionUpdate)
+void WebPageProxy::insertTextAsync(const String& text, const EditingRange& replacementRange, InsertTextOptions&& options)
 {
     if (!hasRunningProcess())
         return;
 
-    process().send(Messages::WebPage::InsertTextAsync(text, replacementRange, registerUndoGroup, static_cast<uint32_t>(editingRangeIsRelativeTo), suppressSelectionUpdate), m_pageID);
+    process().send(Messages::WebPage::InsertTextAsync(text, replacementRange, WTFMove(options)), m_pageID);
 }
 
 void WebPageProxy::getMarkedRangeAsync(WTF::Function<void (EditingRange, CallbackBase::Error)>&& callbackFunction)

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (245072 => 245073)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-05-08 22:24:56 UTC (rev 245072)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-05-08 22:48:31 UTC (rev 245073)
@@ -283,6 +283,7 @@
 struct EditingRange;
 struct EditorState;
 struct FrameInfoData;
+struct InsertTextOptions;
 struct InteractionInformationRequest;
 struct LoadParameters;
 struct PlatformPopupMenuData;
@@ -763,7 +764,7 @@
     CALayer *acceleratedCompositingRootLayer() const;
 
     void setTextAsync(const String&);
-    void insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup = false, EditingRangeIsRelativeTo = EditingRangeIsRelativeTo::EditableRoot, bool suppressSelectionUpdate = false);
+    void insertTextAsync(const String& text, const EditingRange& replacementRange, InsertTextOptions&&);
     void getMarkedRangeAsync(WTF::Function<void (EditingRange, CallbackBase::Error)>&&);
     void getSelectedRangeAsync(WTF::Function<void (EditingRange, CallbackBase::Error)>&&);
     void characterIndexForPointAsync(const WebCore::IntPoint&, WTF::Function<void (uint64_t, CallbackBase::Error)>&&);

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (245072 => 245073)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-05-08 22:24:56 UTC (rev 245072)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-05-08 22:48:31 UTC (rev 245073)
@@ -31,8 +31,8 @@
 #import "APIUIClient.h"
 #import "DocumentEditingContext.h"
 #import "EditableImageController.h"
-#import "EditingRange.h"
 #import "InputViewUpdateDeferrer.h"
+#import "InsertTextOptions.h"
 #import "Logging.h"
 #import "NativeWebKeyboardEvent.h"
 #import "NativeWebTouchEvent.h"
@@ -4165,7 +4165,7 @@
 // Inserts the given string, replacing any selected or marked text.
 - (void)insertText:(NSString *)aStringValue
 {
-    _page->insertTextAsync(aStringValue, WebKit::EditingRange());
+    _page->insertTextAsync(aStringValue, WebKit::EditingRange(), { });
 }
 
 - (BOOL)hasText

Modified: trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm (245072 => 245073)


--- trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm	2019-05-08 22:24:56 UTC (rev 245072)
+++ trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm	2019-05-08 22:48:31 UTC (rev 245073)
@@ -32,8 +32,8 @@
 #import "AttributedString.h"
 #import "ColorSpaceData.h"
 #import "DataReference.h"
-#import "EditingRange.h"
 #import "EditorState.h"
+#import "InsertTextOptions.h"
 #import "MenuUtilities.h"
 #import "NativeWebKeyboardEvent.h"
 #import "PDFContextMenu.h"
@@ -198,13 +198,19 @@
     }
 
     if (dictationAlternatives.isEmpty()) {
-        insertTextAsync(text, replacementRange, registerUndoGroup);
+        InsertTextOptions options;
+        options.registerUndoGroup = registerUndoGroup;
+
+        insertTextAsync(text, replacementRange, WTFMove(options));
         return;
     }
 
     process().send(Messages::WebPage::InsertDictatedTextAsync(text, replacementRange, dictationAlternatives, registerUndoGroup), m_pageID);
 #else
-    insertTextAsync(text, replacementRange, registerUndoGroup);
+    InsertTextOptions options;
+    options.registerUndoGroup = registerUndoGroup;
+
+    insertTextAsync(text, replacementRange, WTFMove(options));
 #endif
 }
 

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (245072 => 245073)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2019-05-08 22:24:56 UTC (rev 245072)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2019-05-08 22:48:31 UTC (rev 245073)
@@ -1595,6 +1595,7 @@
 		CE1A0BD51A48E6C60054EF74 /* ManagedConfigurationSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1A0BCF1A48E6C60054EF74 /* ManagedConfigurationSPI.h */; };
 		CE1A0BD61A48E6C60054EF74 /* TCCSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1A0BD01A48E6C60054EF74 /* TCCSPI.h */; };
 		CE1A0BD71A48E6C60054EF74 /* TextInputSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE1A0BD11A48E6C60054EF74 /* TextInputSPI.h */; };
+		CE550E152283752200D28791 /* InsertTextOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = CE550E12228373C800D28791 /* InsertTextOptions.h */; };
 		CE5B4C8821B73D870022E64F /* WKSyntheticFlagsChangedWebEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = CE5B4C8621B73D870022E64F /* WKSyntheticFlagsChangedWebEvent.h */; };
 		CE70EE5D22442BD000E0AF0F /* WKFormPeripheralBase.h in Headers */ = {isa = PBXBuildFile; fileRef = CE70EE5C22442BD000E0AF0F /* WKFormPeripheralBase.h */; };
 		CEC8F9CB1FDF5870002635E7 /* WKWebProcessPlugInNodeHandlePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = CEC8F9CA1FDF5870002635E7 /* WKWebProcessPlugInNodeHandlePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -4504,6 +4505,8 @@
 		CE1A0BCF1A48E6C60054EF74 /* ManagedConfigurationSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ManagedConfigurationSPI.h; sourceTree = "<group>"; };
 		CE1A0BD01A48E6C60054EF74 /* TCCSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCCSPI.h; sourceTree = "<group>"; };
 		CE1A0BD11A48E6C60054EF74 /* TextInputSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextInputSPI.h; sourceTree = "<group>"; };
+		CE550E12228373C800D28791 /* InsertTextOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InsertTextOptions.h; sourceTree = "<group>"; };
+		CE550E132283744400D28791 /* InsertTextOptions.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InsertTextOptions.cpp; sourceTree = "<group>"; };
 		CE5B4C8621B73D870022E64F /* WKSyntheticFlagsChangedWebEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WKSyntheticFlagsChangedWebEvent.h; path = ios/WKSyntheticFlagsChangedWebEvent.h; sourceTree = "<group>"; };
 		CE5B4C8721B73D870022E64F /* WKSyntheticFlagsChangedWebEvent.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WKSyntheticFlagsChangedWebEvent.mm; path = ios/WKSyntheticFlagsChangedWebEvent.mm; sourceTree = "<group>"; };
 		CE70EE5A22442BB300E0AF0F /* WKFormPeripheralBase.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WKFormPeripheralBase.mm; path = ios/forms/WKFormPeripheralBase.mm; sourceTree = "<group>"; };
@@ -6352,6 +6355,8 @@
 				37BEC4DE19491486008B4286 /* CompletionHandlerCallChecker.mm */,
 				C55F916C1C595E440029E92D /* DataDetectionResult.h */,
 				C55F916D1C595E440029E92D /* DataDetectionResult.mm */,
+				CE550E132283744400D28791 /* InsertTextOptions.cpp */,
+				CE550E12228373C800D28791 /* InsertTextOptions.h */,
 				2D1087621D2C641B00B85F82 /* LoadParametersCocoa.mm */,
 				CD2865EC2255562000606AC7 /* ProcessTaskStateObserver.h */,
 				CD2865ED2255562000606AC7 /* ProcessTaskStateObserver.mm */,
@@ -9277,6 +9282,7 @@
 				BC33E0D112408E8600360F3F /* InjectedBundleRangeHandle.h in Headers */,
 				BC14DF77120B5B7900826C0C /* InjectedBundleScriptWorld.h in Headers */,
 				2DD45ADE1E5F8972006C355F /* InputViewUpdateDeferrer.h in Headers */,
+				CE550E152283752200D28791 /* InsertTextOptions.h in Headers */,
 				A5E391FD2183C1F800C8FB31 /* InspectorTargetProxy.h in Headers */,
 				C5BCE5DF1C50766A00CDE3FA /* InteractionInformationAtPosition.h in Headers */,
 				2D4D2C811DF60BF3002EB10C /* InteractionInformationRequest.h in Headers */,

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (245072 => 245073)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-05-08 22:24:56 UTC (rev 245072)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2019-05-08 22:48:31 UTC (rev 245073)
@@ -253,6 +253,7 @@
 #endif
 
 #if PLATFORM(COCOA)
+#include "InsertTextOptions.h"
 #include "PDFPlugin.h"
 #include "PlaybackSessionManager.h"
 #include "RemoteLayerTreeTransaction.h"
@@ -5128,7 +5129,7 @@
     ASSERT_NOT_REACHED();
 }
 
-void WebPage::insertTextAsync(const String& text, const EditingRange& replacementEditingRange, bool registerUndoGroup, uint32_t editingRangeIsRelativeTo, bool suppressSelectionUpdate)
+void WebPage::insertTextAsync(const String& text, const EditingRange& replacementEditingRange, InsertTextOptions&& options)
 {
     Frame& frame = m_page->focusController().focusedOrMainFrame();
 
@@ -5136,14 +5137,14 @@
 
     bool replacesText = false;
     if (replacementEditingRange.location != notFound) {
-        if (auto replacementRange = EditingRange::toRange(frame, replacementEditingRange, static_cast<EditingRangeIsRelativeTo>(editingRangeIsRelativeTo))) {
-            SetForScope<bool> isSelectingTextWhileInsertingAsynchronously(m_isSelectingTextWhileInsertingAsynchronously, suppressSelectionUpdate);
+        if (auto replacementRange = EditingRange::toRange(frame, replacementEditingRange, options.editingRangeIsRelativeTo)) {
+            SetForScope<bool> isSelectingTextWhileInsertingAsynchronously(m_isSelectingTextWhileInsertingAsynchronously, options.suppressSelectionUpdate);
             frame.selection().setSelection(VisibleSelection(*replacementRange, SEL_DEFAULT_AFFINITY));
             replacesText = replacementEditingRange.length;
         }
     }
     
-    if (registerUndoGroup)
+    if (options.registerUndoGroup)
         send(Messages::WebPageProxy::RegisterInsertionUndoGrouping());
     
     if (!frame.editor().hasComposition()) {

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (245072 => 245073)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-05-08 22:24:56 UTC (rev 245072)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-05-08 22:48:31 UTC (rev 245073)
@@ -252,9 +252,10 @@
 enum class DragControllerAction : uint8_t;
 
 struct AttributedString;
+struct BackForwardListItemState;
 struct DataDetectionResult;
-struct BackForwardListItemState;
 struct EditorState;
+struct InsertTextOptions;
 struct InteractionInformationAtPosition;
 struct InteractionInformationRequest;
 struct LoadParameters;
@@ -785,7 +786,7 @@
     void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
 
     void setTextAsync(const String&);
-    void insertTextAsync(const String& text, const EditingRange& replacementRange, bool registerUndoGroup = false, uint32_t editingRangeIsRelativeTo = (uint32_t)EditingRangeIsRelativeTo::EditableRoot, bool suppressSelectionUpdate = false);
+    void insertTextAsync(const String& text, const EditingRange& replacementRange, InsertTextOptions&&);
     void getMarkedRangeAsync(CallbackID);
     void getSelectedRangeAsync(CallbackID);
     void characterIndexForPointAsync(const WebCore::IntPoint&, CallbackID);

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (245072 => 245073)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2019-05-08 22:24:56 UTC (rev 245072)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2019-05-08 22:48:31 UTC (rev 245073)
@@ -432,7 +432,7 @@
     AcceptsFirstMouse(int eventNumber, WebKit::WebMouseEvent event) -> (bool result) Synchronous
 
     SetTextAsync(String text)
-    InsertTextAsync(String text, struct WebKit::EditingRange replacementRange, bool registerUndoGroup, uint32_t editingRangeIsRelativeTo, bool suppressSelectionUpdate)
+    InsertTextAsync(String text, struct WebKit::EditingRange replacementRange, struct WebKit::InsertTextOptions options)
     GetMarkedRangeAsync(WebKit::CallbackID callbackID)
     GetSelectedRangeAsync(WebKit::CallbackID callbackID)
     CharacterIndexForPointAsync(WebCore::IntPoint point, WebKit::CallbackID callbackID);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to