Title: [256948] trunk/Source/WebKitLegacy
Revision
256948
Author
dba...@webkit.org
Date
2020-02-19 14:02:10 -0800 (Wed, 19 Feb 2020)

Log Message

[iOS][LegacyWebKit] Override EditorClient::shouldRevealCurrentSelectionAfterInsertion()
https://bugs.webkit.org/show_bug.cgi?id=207955
<rdar://problem/59602916>

Reviewed by Wenson Hsieh.

Source/WebKitLegacy/ios:

Adds a stub function for -shouldRevealCurrentSelectionAfterInsertion that returns YES,
to keep our current behavior.

* DefaultDelegates/WebDefaultUIKitDelegate.m:
(-[WebDefaultUIKitDelegate shouldRevealCurrentSelectionAfterInsertion]): Added.
* WebView/WebUIKitDelegate.h:

Source/WebKitLegacy/mac:

Wire up EditorClient::shouldRevealCurrentSelectionAfterInsertion() in Legacy WebKit. This
allows Legacy WebKit clients to toggle whether the current selection is revealed after
an insertion, which they may want to do to achieve a desired UI effect.

* WebCoreSupport/WebEditorClient.h:
* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::shouldRevealCurrentSelectionAfterInsertion const): Added. Ask the _UIKitDelegateForwarder
if it responds to -shouldRevealCurrentSelectionAfterInsertion. If it does then return its
response. Otherwise, return true to do what we do now: reveal the current selection after
an insertion.

Modified Paths

Diff

Modified: trunk/Source/WebKitLegacy/ios/ChangeLog (256947 => 256948)


--- trunk/Source/WebKitLegacy/ios/ChangeLog	2020-02-19 21:54:40 UTC (rev 256947)
+++ trunk/Source/WebKitLegacy/ios/ChangeLog	2020-02-19 22:02:10 UTC (rev 256948)
@@ -1,3 +1,18 @@
+2020-02-19  Daniel Bates  <daba...@apple.com>
+
+        [iOS][LegacyWebKit] Override EditorClient::shouldRevealCurrentSelectionAfterInsertion()
+        https://bugs.webkit.org/show_bug.cgi?id=207955
+        <rdar://problem/59602916>
+
+        Reviewed by Wenson Hsieh.
+
+        Adds a stub function for -shouldRevealCurrentSelectionAfterInsertion that returns YES,
+        to keep our current behavior.
+
+        * DefaultDelegates/WebDefaultUIKitDelegate.m:
+        (-[WebDefaultUIKitDelegate shouldRevealCurrentSelectionAfterInsertion]): Added.
+        * WebView/WebUIKitDelegate.h:
+
 2020-02-07  Jon Lee  <jon...@apple.com>
 
         Web Inspector: Revert slim toolbar

Modified: trunk/Source/WebKitLegacy/ios/DefaultDelegates/WebDefaultUIKitDelegate.m (256947 => 256948)


--- trunk/Source/WebKitLegacy/ios/DefaultDelegates/WebDefaultUIKitDelegate.m	2020-02-19 21:54:40 UTC (rev 256947)
+++ trunk/Source/WebKitLegacy/ios/DefaultDelegates/WebDefaultUIKitDelegate.m	2020-02-19 22:02:10 UTC (rev 256948)
@@ -252,6 +252,11 @@
     return CGPointZero;
 }
 
+- (BOOL)shouldRevealCurrentSelectionAfterInsertion
+{
+    return YES;
+}
+
 - (void)showPlaybackTargetPicker:(BOOL)hasVideo fromRect:(CGRect)elementRect
 {
 }

Modified: trunk/Source/WebKitLegacy/ios/WebView/WebUIKitDelegate.h (256947 => 256948)


--- trunk/Source/WebKitLegacy/ios/WebView/WebUIKitDelegate.h	2020-02-19 21:54:40 UTC (rev 256947)
+++ trunk/Source/WebKitLegacy/ios/WebView/WebUIKitDelegate.h	2020-02-19 22:02:10 UTC (rev 256948)
@@ -126,6 +126,8 @@
 - (CGPoint)interactionLocation;
 - (void)showPlaybackTargetPicker:(BOOL)hasVideo fromRect:(CGRect)elementRect;
 
+- (BOOL)shouldRevealCurrentSelectionAfterInsertion;
+
 #if ENABLE_ORIENTATION_EVENTS
 - (int)deviceOrientation;
 #endif

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (256947 => 256948)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2020-02-19 21:54:40 UTC (rev 256947)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2020-02-19 22:02:10 UTC (rev 256948)
@@ -1,3 +1,22 @@
+2020-02-19  Daniel Bates  <daba...@apple.com>
+
+        [iOS][LegacyWebKit] Override EditorClient::shouldRevealCurrentSelectionAfterInsertion()
+        https://bugs.webkit.org/show_bug.cgi?id=207955
+        <rdar://problem/59602916>
+
+        Reviewed by Wenson Hsieh.
+
+        Wire up EditorClient::shouldRevealCurrentSelectionAfterInsertion() in Legacy WebKit. This
+        allows Legacy WebKit clients to toggle whether the current selection is revealed after
+        an insertion, which they may want to do to achieve a desired UI effect.
+
+        * WebCoreSupport/WebEditorClient.h:
+        * WebCoreSupport/WebEditorClient.mm:
+        (WebEditorClient::shouldRevealCurrentSelectionAfterInsertion const): Added. Ask the _UIKitDelegateForwarder
+        if it responds to -shouldRevealCurrentSelectionAfterInsertion. If it does then return its
+        response. Otherwise, return true to do what we do now: reveal the current selection after
+        an insertion.
+
 2020-02-18  Simon Fraser  <simon.fra...@apple.com>
 
         Move from "layer flush" terminology to "rendering update"

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h (256947 => 256948)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h	2020-02-19 21:54:40 UTC (rev 256947)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.h	2020-02-19 22:02:10 UTC (rev 256948)
@@ -148,6 +148,8 @@
     RefPtr<WebCore::DocumentFragment> documentFragmentFromDelegate(int index) final;
     bool performsTwoStepPaste(WebCore::DocumentFragment*) final;
     void updateStringForFind(const String&) final { }
+
+    bool shouldRevealCurrentSelectionAfterInsertion() const final;
 #endif
 
     bool performTwoStepDrop(WebCore::DocumentFragment&, WebCore::Range& destination, bool isMove) final;

Modified: trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm (256947 => 256948)


--- trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm	2020-02-19 21:54:40 UTC (rev 256947)
+++ trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebEditorClient.mm	2020-02-19 22:02:10 UTC (rev 256948)
@@ -823,6 +823,13 @@
     return 0;
 }
 
+bool WebEditorClient::shouldRevealCurrentSelectionAfterInsertion() const
+{
+    if ([[m_webView _UIKitDelegateForwarder] respondsToSelector:@selector(shouldRevealCurrentSelectionAfterInsertion)])
+        return [[m_webView _UIKitDelegateForwarder] shouldRevealCurrentSelectionAfterInsertion];
+    return true;
+}
+
 RefPtr<WebCore::DocumentFragment> WebEditorClient::documentFragmentFromDelegate(int index)
 {
     if ([[m_webView _editingDelegateForwarder] respondsToSelector:@selector(documentFragmentForPasteboardItemAtIndex:)]) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to