Title: [260211] branches/safari-610.1.10-branch
Revision
260211
Author
[email protected]
Date
2020-04-16 12:31:10 -0700 (Thu, 16 Apr 2020)

Log Message

Cherry-pick r260192. rdar://problem/61897737

    Move -_requestTextInputContextsInRect to WKContentView to simplify implementation
    https://bugs.webkit.org/show_bug.cgi?id=210398
    <rdar://problem/61656931>

    Reviewed by Darin Adler.

    Source/WebKit:

    -_requestTextInputContextsInRect is not needed on Mac, but supporting it complicates
    its implementation: it has to deal with coordinate space differences due to differences
    in what is the root view on Mac and iOS + it has to know about iOS's custom content views.
    While this function was in the "SPI" header, there is no software at Apple that was using
    these outside of WebKit, and I will assume no non-Apple software was using them either.
    Moving this function to WKContentView lets me simplify the implementation.

    * Platform/spi/ios/UIKitSPI.h: Add more forward declarations.
    * UIProcess/API/Cocoa/WKWebView.mm:
    (-[WKWebView _convertRectFromRootViewCoordinates:]): Deleted.
    (-[WKWebView _convertRectToRootViewCoordinates:]): Deleted.
    (-[WKWebView _mayContainEditableElementsInRect:]): Deleted; moved to WKWebViewTestingIOS.mm.
    (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Deleted; moved to WKContentViewInteraction.mm.
    * UIProcess/API/Cocoa/WKWebViewPrivate.h:
    * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
    * UIProcess/API/ios/WKWebViewTestingIOS.mm:
    (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Added. Turns around and
    calls the function of the same name on the WKContentView. It takes care to convert the specified
    rect from WKWebView coordinates to WKContentView coordinates and fixes up the bounding rects
    for the returned contexts to be in WKWebView coordinates. This keeps existings tests passing
    as mekes using this function intuitive since callers specify and get rects in WKWebView coordinates.
    (-[WKWebView _requestDocumentContext:completionHandler:]): Added.
    (-[WKWebView _adjustSelectionWithDelta:completionHandler:]): Added.
    (-[WKWebView _mayContainEditableElementsInRect:]): Moved from WKWebView.mm.
    * UIProcess/ios/WKContentViewInteraction.h:
    * UIProcess/ios/WKContentViewInteraction.mm:
    (-[WKContentView _requestTextInputContextsInRect:completionHandler:]): Moved from WKWebView.mm and simplified.

    Source/WTF:

    Add a convenience function to create an NSArray from a WTF::Vector with a transform function.
    The tranform function can either return a RetainPtr or an id.

    * wtf/cocoa/VectorCocoa.h:
    (WTF::createNSArray): Added.

    Tools:

    Update test now that -_requestTextInputContextsInRect has moved from WKWebView to WKContentView.
    I expose new testing-only WKWebView SPI to access it on the content view.

    * TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm:
    (-[TestWKWebView synchronouslyRequestDocumentContext:]): Added; due to category name change.
    (-[TestWKWebView synchronouslyAdjustSelectionWithDelta:]): Added; due to category name change.
    * TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm:
    (-[WKWebView synchronouslyRequestTextInputContextsInRect:]): Deleted; due to category name change.
    (-[WKWebView synchronouslyFocusTextInputContext:]): Deleted; due to category name change.
    * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
    (WTR::UIScriptControllerIOS::mayContainEditableElementsInRect): Convert from content coordinates
    to WKWebView coordinates now that -_mayContainEditableElementsInRect expects it.

    LayoutTests:

    Update test and expected results now that UIScriptController.mayContainEditableElementsInRect()
    expects the passed rect to be in content coordinates.

    I replaced one sub-test of a rect pre-scroll with another that tests the location
    of a rect that will have editable elements after scroll. The purpose of that sub-test
    hasn't changed, but it now makes the sub-tests' rects symmetric for before and after
    scroll. I also added debug() statements to demarcate the before scroll and after scroll
    sub-tests in the results to make it easier to understand what this test file is testing.

    * editing/editable-region/hit-test-fixed-expected.txt:
    * editing/editable-region/hit-test-fixed.html:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260192 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-610.1.10-branch/LayoutTests/ChangeLog (260210 => 260211)


--- branches/safari-610.1.10-branch/LayoutTests/ChangeLog	2020-04-16 19:31:05 UTC (rev 260210)
+++ branches/safari-610.1.10-branch/LayoutTests/ChangeLog	2020-04-16 19:31:10 UTC (rev 260211)
@@ -1,3 +1,102 @@
+2020-04-16  Alan Coon  <[email protected]>
+
+        Cherry-pick r260192. rdar://problem/61897737
+
+    Move -_requestTextInputContextsInRect to WKContentView to simplify implementation
+    https://bugs.webkit.org/show_bug.cgi?id=210398
+    <rdar://problem/61656931>
+    
+    Reviewed by Darin Adler.
+    
+    Source/WebKit:
+    
+    -_requestTextInputContextsInRect is not needed on Mac, but supporting it complicates
+    its implementation: it has to deal with coordinate space differences due to differences
+    in what is the root view on Mac and iOS + it has to know about iOS's custom content views.
+    While this function was in the "SPI" header, there is no software at Apple that was using
+    these outside of WebKit, and I will assume no non-Apple software was using them either.
+    Moving this function to WKContentView lets me simplify the implementation.
+    
+    * Platform/spi/ios/UIKitSPI.h: Add more forward declarations.
+    * UIProcess/API/Cocoa/WKWebView.mm:
+    (-[WKWebView _convertRectFromRootViewCoordinates:]): Deleted.
+    (-[WKWebView _convertRectToRootViewCoordinates:]): Deleted.
+    (-[WKWebView _mayContainEditableElementsInRect:]): Deleted; moved to WKWebViewTestingIOS.mm.
+    (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Deleted; moved to WKContentViewInteraction.mm.
+    * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+    * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
+    * UIProcess/API/ios/WKWebViewTestingIOS.mm:
+    (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Added. Turns around and
+    calls the function of the same name on the WKContentView. It takes care to convert the specified
+    rect from WKWebView coordinates to WKContentView coordinates and fixes up the bounding rects
+    for the returned contexts to be in WKWebView coordinates. This keeps existings tests passing
+    as mekes using this function intuitive since callers specify and get rects in WKWebView coordinates.
+    (-[WKWebView _requestDocumentContext:completionHandler:]): Added.
+    (-[WKWebView _adjustSelectionWithDelta:completionHandler:]): Added.
+    (-[WKWebView _mayContainEditableElementsInRect:]): Moved from WKWebView.mm.
+    * UIProcess/ios/WKContentViewInteraction.h:
+    * UIProcess/ios/WKContentViewInteraction.mm:
+    (-[WKContentView _requestTextInputContextsInRect:completionHandler:]): Moved from WKWebView.mm and simplified.
+    
+    Source/WTF:
+    
+    Add a convenience function to create an NSArray from a WTF::Vector with a transform function.
+    The tranform function can either return a RetainPtr or an id.
+    
+    * wtf/cocoa/VectorCocoa.h:
+    (WTF::createNSArray): Added.
+    
+    Tools:
+    
+    Update test now that -_requestTextInputContextsInRect has moved from WKWebView to WKContentView.
+    I expose new testing-only WKWebView SPI to access it on the content view.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm:
+    (-[TestWKWebView synchronouslyRequestDocumentContext:]): Added; due to category name change.
+    (-[TestWKWebView synchronouslyAdjustSelectionWithDelta:]): Added; due to category name change.
+    * TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm:
+    (-[WKWebView synchronouslyRequestTextInputContextsInRect:]): Deleted; due to category name change.
+    (-[WKWebView synchronouslyFocusTextInputContext:]): Deleted; due to category name change.
+    * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+    (WTR::UIScriptControllerIOS::mayContainEditableElementsInRect): Convert from content coordinates
+    to WKWebView coordinates now that -_mayContainEditableElementsInRect expects it.
+    
+    LayoutTests:
+    
+    Update test and expected results now that UIScriptController.mayContainEditableElementsInRect()
+    expects the passed rect to be in content coordinates.
+    
+    I replaced one sub-test of a rect pre-scroll with another that tests the location
+    of a rect that will have editable elements after scroll. The purpose of that sub-test
+    hasn't changed, but it now makes the sub-tests' rects symmetric for before and after
+    scroll. I also added debug() statements to demarcate the before scroll and after scroll
+    sub-tests in the results to make it easier to understand what this test file is testing.
+    
+    * editing/editable-region/hit-test-fixed-expected.txt:
+    * editing/editable-region/hit-test-fixed.html:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260192 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-04-16  Daniel Bates  <[email protected]>
+
+            Move -_requestTextInputContextsInRect to WKContentView to simplify implementation
+            https://bugs.webkit.org/show_bug.cgi?id=210398
+            <rdar://problem/61656931>
+
+            Reviewed by Darin Adler.
+
+            Update test and expected results now that UIScriptController.mayContainEditableElementsInRect()
+            expects the passed rect to be in content coordinates.
+
+            I replaced one sub-test of a rect pre-scroll with another that tests the location
+            of a rect that will have editable elements after scroll. The purpose of that sub-test
+            hasn't changed, but it now makes the sub-tests' rects symmetric for before and after
+            scroll. I also added debug() statements to demarcate the before scroll and after scroll
+            sub-tests in the results to make it easier to understand what this test file is testing.
+
+            * editing/editable-region/hit-test-fixed-expected.txt:
+            * editing/editable-region/hit-test-fixed.html:
+
 2020-04-11  Jack Lee  <[email protected]>
 
         Infinite loop in InsertListCommand::doApply()

Modified: branches/safari-610.1.10-branch/LayoutTests/editing/editable-region/hit-test-fixed-expected.txt (260210 => 260211)


--- branches/safari-610.1.10-branch/LayoutTests/editing/editable-region/hit-test-fixed-expected.txt	2020-04-16 19:31:05 UTC (rev 260210)
+++ branches/safari-610.1.10-branch/LayoutTests/editing/editable-region/hit-test-fixed-expected.txt	2020-04-16 19:31:10 UTC (rev 260211)
@@ -3,9 +3,13 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+Before scroll:
 PASS (x = 0, y = 0, width = 200, height = 40) contains editable elements.
-PASS (x = 0, y = 100, width = 50, height = 50) does not contain editable elements.
-PASS (x = 0, y = 0, width = 200, height = 40) contains editable elements.
+PASS (x = 0, y = 200, width = 200, height = 40) does not contain editable elements.
+
+After scroll:
+PASS (x = 0, y = 0, width = 200, height = 40) does not contain editable elements.
+PASS (x = 0, y = 200, width = 200, height = 40) contains editable elements.
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: branches/safari-610.1.10-branch/LayoutTests/editing/editable-region/hit-test-fixed.html (260210 => 260211)


--- branches/safari-610.1.10-branch/LayoutTests/editing/editable-region/hit-test-fixed.html	2020-04-16 19:31:05 UTC (rev 260210)
+++ branches/safari-610.1.10-branch/LayoutTests/editing/editable-region/hit-test-fixed.html	2020-04-16 19:31:10 UTC (rev 260211)
@@ -29,12 +29,16 @@
         return;
     }
 
+    debug("Before scroll:");
     await shouldHaveEditableElementsInRect(0, 0, 200, 40);
-    await shouldNotHaveEditableElementsInRect(0, 100, 50, 50);
+    await shouldNotHaveEditableElementsInRect(0, 200, 200, 40);
 
-    window.scrollTo(0, 200);
+    let newYOffset = 200;
+    window.scrollTo(0, newYOffset);
 
-    await shouldHaveEditableElementsInRect(0, 0, 200, 40);
+    debug("<br>After scroll:");
+    await shouldNotHaveEditableElementsInRect(0, 0, 200, 40);
+    await shouldHaveEditableElementsInRect(0, newYOffset, 200, 40);
 
     let testContainer = document.getElementById("test-container");
     document.body.removeChild(testContainer);

Modified: branches/safari-610.1.10-branch/Source/WTF/ChangeLog (260210 => 260211)


--- branches/safari-610.1.10-branch/Source/WTF/ChangeLog	2020-04-16 19:31:05 UTC (rev 260210)
+++ branches/safari-610.1.10-branch/Source/WTF/ChangeLog	2020-04-16 19:31:10 UTC (rev 260211)
@@ -1,3 +1,96 @@
+2020-04-16  Alan Coon  <[email protected]>
+
+        Cherry-pick r260192. rdar://problem/61897737
+
+    Move -_requestTextInputContextsInRect to WKContentView to simplify implementation
+    https://bugs.webkit.org/show_bug.cgi?id=210398
+    <rdar://problem/61656931>
+    
+    Reviewed by Darin Adler.
+    
+    Source/WebKit:
+    
+    -_requestTextInputContextsInRect is not needed on Mac, but supporting it complicates
+    its implementation: it has to deal with coordinate space differences due to differences
+    in what is the root view on Mac and iOS + it has to know about iOS's custom content views.
+    While this function was in the "SPI" header, there is no software at Apple that was using
+    these outside of WebKit, and I will assume no non-Apple software was using them either.
+    Moving this function to WKContentView lets me simplify the implementation.
+    
+    * Platform/spi/ios/UIKitSPI.h: Add more forward declarations.
+    * UIProcess/API/Cocoa/WKWebView.mm:
+    (-[WKWebView _convertRectFromRootViewCoordinates:]): Deleted.
+    (-[WKWebView _convertRectToRootViewCoordinates:]): Deleted.
+    (-[WKWebView _mayContainEditableElementsInRect:]): Deleted; moved to WKWebViewTestingIOS.mm.
+    (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Deleted; moved to WKContentViewInteraction.mm.
+    * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+    * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
+    * UIProcess/API/ios/WKWebViewTestingIOS.mm:
+    (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Added. Turns around and
+    calls the function of the same name on the WKContentView. It takes care to convert the specified
+    rect from WKWebView coordinates to WKContentView coordinates and fixes up the bounding rects
+    for the returned contexts to be in WKWebView coordinates. This keeps existings tests passing
+    as mekes using this function intuitive since callers specify and get rects in WKWebView coordinates.
+    (-[WKWebView _requestDocumentContext:completionHandler:]): Added.
+    (-[WKWebView _adjustSelectionWithDelta:completionHandler:]): Added.
+    (-[WKWebView _mayContainEditableElementsInRect:]): Moved from WKWebView.mm.
+    * UIProcess/ios/WKContentViewInteraction.h:
+    * UIProcess/ios/WKContentViewInteraction.mm:
+    (-[WKContentView _requestTextInputContextsInRect:completionHandler:]): Moved from WKWebView.mm and simplified.
+    
+    Source/WTF:
+    
+    Add a convenience function to create an NSArray from a WTF::Vector with a transform function.
+    The tranform function can either return a RetainPtr or an id.
+    
+    * wtf/cocoa/VectorCocoa.h:
+    (WTF::createNSArray): Added.
+    
+    Tools:
+    
+    Update test now that -_requestTextInputContextsInRect has moved from WKWebView to WKContentView.
+    I expose new testing-only WKWebView SPI to access it on the content view.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm:
+    (-[TestWKWebView synchronouslyRequestDocumentContext:]): Added; due to category name change.
+    (-[TestWKWebView synchronouslyAdjustSelectionWithDelta:]): Added; due to category name change.
+    * TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm:
+    (-[WKWebView synchronouslyRequestTextInputContextsInRect:]): Deleted; due to category name change.
+    (-[WKWebView synchronouslyFocusTextInputContext:]): Deleted; due to category name change.
+    * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+    (WTR::UIScriptControllerIOS::mayContainEditableElementsInRect): Convert from content coordinates
+    to WKWebView coordinates now that -_mayContainEditableElementsInRect expects it.
+    
+    LayoutTests:
+    
+    Update test and expected results now that UIScriptController.mayContainEditableElementsInRect()
+    expects the passed rect to be in content coordinates.
+    
+    I replaced one sub-test of a rect pre-scroll with another that tests the location
+    of a rect that will have editable elements after scroll. The purpose of that sub-test
+    hasn't changed, but it now makes the sub-tests' rects symmetric for before and after
+    scroll. I also added debug() statements to demarcate the before scroll and after scroll
+    sub-tests in the results to make it easier to understand what this test file is testing.
+    
+    * editing/editable-region/hit-test-fixed-expected.txt:
+    * editing/editable-region/hit-test-fixed.html:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260192 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-04-16  Daniel Bates  <[email protected]>
+
+            Move -_requestTextInputContextsInRect to WKContentView to simplify implementation
+            https://bugs.webkit.org/show_bug.cgi?id=210398
+            <rdar://problem/61656931>
+
+            Reviewed by Darin Adler.
+
+            Add a convenience function to create an NSArray from a WTF::Vector with a transform function.
+            The tranform function can either return a RetainPtr or an id.
+
+            * wtf/cocoa/VectorCocoa.h:
+            (WTF::createNSArray): Added.
+
 2020-04-10  Alex Christensen  <[email protected]>
 
         PersistentCoders should use modern decoding syntax

Modified: branches/safari-610.1.10-branch/Source/WTF/wtf/cocoa/VectorCocoa.h (260210 => 260211)


--- branches/safari-610.1.10-branch/Source/WTF/wtf/cocoa/VectorCocoa.h	2020-04-16 19:31:05 UTC (rev 260210)
+++ branches/safari-610.1.10-branch/Source/WTF/wtf/cocoa/VectorCocoa.h	2020-04-16 19:31:10 UTC (rev 260211)
@@ -47,6 +47,7 @@
 //    Optional<VectorElementType> makeVectorElement(const VectorElementType*, id arrayElement);
 
 template<typename VectorType> RetainPtr<NSArray> createNSArray(const VectorType&);
+template<typename VectorType, typename MapFunction> RetainPtr<NSArray> createNSArray(const VectorType&, MapFunction);
 template<typename VectorElementType> Vector<VectorElementType> makeVector(NSArray *);
 
 // Implementation details of the function templates above.
@@ -60,6 +61,15 @@
     return array;
 }
 
+template<typename VectorType, typename MapFunction> RetainPtr<NSArray> createNSArray(const VectorType& vector, MapFunction mapFunction)
+{
+    auto size = vector.size();
+    auto array = adoptNS([[NSMutableArray alloc] initWithCapacity:size]);
+    for (auto& element : vector)
+        [array addObject:getPtr(mapFunction(element))];
+    return array;
+}
+
 template<typename VectorElementType> Vector<VectorElementType> makeVector(NSArray *array)
 {
     Vector<VectorElementType> vector;

Modified: branches/safari-610.1.10-branch/Source/WebKit/ChangeLog (260210 => 260211)


--- branches/safari-610.1.10-branch/Source/WebKit/ChangeLog	2020-04-16 19:31:05 UTC (rev 260210)
+++ branches/safari-610.1.10-branch/Source/WebKit/ChangeLog	2020-04-16 19:31:10 UTC (rev 260211)
@@ -1,5 +1,120 @@
 2020-04-16  Alan Coon  <[email protected]>
 
+        Cherry-pick r260192. rdar://problem/61897737
+
+    Move -_requestTextInputContextsInRect to WKContentView to simplify implementation
+    https://bugs.webkit.org/show_bug.cgi?id=210398
+    <rdar://problem/61656931>
+    
+    Reviewed by Darin Adler.
+    
+    Source/WebKit:
+    
+    -_requestTextInputContextsInRect is not needed on Mac, but supporting it complicates
+    its implementation: it has to deal with coordinate space differences due to differences
+    in what is the root view on Mac and iOS + it has to know about iOS's custom content views.
+    While this function was in the "SPI" header, there is no software at Apple that was using
+    these outside of WebKit, and I will assume no non-Apple software was using them either.
+    Moving this function to WKContentView lets me simplify the implementation.
+    
+    * Platform/spi/ios/UIKitSPI.h: Add more forward declarations.
+    * UIProcess/API/Cocoa/WKWebView.mm:
+    (-[WKWebView _convertRectFromRootViewCoordinates:]): Deleted.
+    (-[WKWebView _convertRectToRootViewCoordinates:]): Deleted.
+    (-[WKWebView _mayContainEditableElementsInRect:]): Deleted; moved to WKWebViewTestingIOS.mm.
+    (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Deleted; moved to WKContentViewInteraction.mm.
+    * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+    * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
+    * UIProcess/API/ios/WKWebViewTestingIOS.mm:
+    (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Added. Turns around and
+    calls the function of the same name on the WKContentView. It takes care to convert the specified
+    rect from WKWebView coordinates to WKContentView coordinates and fixes up the bounding rects
+    for the returned contexts to be in WKWebView coordinates. This keeps existings tests passing
+    as mekes using this function intuitive since callers specify and get rects in WKWebView coordinates.
+    (-[WKWebView _requestDocumentContext:completionHandler:]): Added.
+    (-[WKWebView _adjustSelectionWithDelta:completionHandler:]): Added.
+    (-[WKWebView _mayContainEditableElementsInRect:]): Moved from WKWebView.mm.
+    * UIProcess/ios/WKContentViewInteraction.h:
+    * UIProcess/ios/WKContentViewInteraction.mm:
+    (-[WKContentView _requestTextInputContextsInRect:completionHandler:]): Moved from WKWebView.mm and simplified.
+    
+    Source/WTF:
+    
+    Add a convenience function to create an NSArray from a WTF::Vector with a transform function.
+    The tranform function can either return a RetainPtr or an id.
+    
+    * wtf/cocoa/VectorCocoa.h:
+    (WTF::createNSArray): Added.
+    
+    Tools:
+    
+    Update test now that -_requestTextInputContextsInRect has moved from WKWebView to WKContentView.
+    I expose new testing-only WKWebView SPI to access it on the content view.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm:
+    (-[TestWKWebView synchronouslyRequestDocumentContext:]): Added; due to category name change.
+    (-[TestWKWebView synchronouslyAdjustSelectionWithDelta:]): Added; due to category name change.
+    * TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm:
+    (-[WKWebView synchronouslyRequestTextInputContextsInRect:]): Deleted; due to category name change.
+    (-[WKWebView synchronouslyFocusTextInputContext:]): Deleted; due to category name change.
+    * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+    (WTR::UIScriptControllerIOS::mayContainEditableElementsInRect): Convert from content coordinates
+    to WKWebView coordinates now that -_mayContainEditableElementsInRect expects it.
+    
+    LayoutTests:
+    
+    Update test and expected results now that UIScriptController.mayContainEditableElementsInRect()
+    expects the passed rect to be in content coordinates.
+    
+    I replaced one sub-test of a rect pre-scroll with another that tests the location
+    of a rect that will have editable elements after scroll. The purpose of that sub-test
+    hasn't changed, but it now makes the sub-tests' rects symmetric for before and after
+    scroll. I also added debug() statements to demarcate the before scroll and after scroll
+    sub-tests in the results to make it easier to understand what this test file is testing.
+    
+    * editing/editable-region/hit-test-fixed-expected.txt:
+    * editing/editable-region/hit-test-fixed.html:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260192 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-04-16  Daniel Bates  <[email protected]>
+
+            Move -_requestTextInputContextsInRect to WKContentView to simplify implementation
+            https://bugs.webkit.org/show_bug.cgi?id=210398
+            <rdar://problem/61656931>
+
+            Reviewed by Darin Adler.
+
+            -_requestTextInputContextsInRect is not needed on Mac, but supporting it complicates
+            its implementation: it has to deal with coordinate space differences due to differences
+            in what is the root view on Mac and iOS + it has to know about iOS's custom content views.
+            While this function was in the "SPI" header, there is no software at Apple that was using
+            these outside of WebKit, and I will assume no non-Apple software was using them either.
+            Moving this function to WKContentView lets me simplify the implementation.
+
+            * Platform/spi/ios/UIKitSPI.h: Add more forward declarations.
+            * UIProcess/API/Cocoa/WKWebView.mm:
+            (-[WKWebView _convertRectFromRootViewCoordinates:]): Deleted.
+            (-[WKWebView _convertRectToRootViewCoordinates:]): Deleted.
+            (-[WKWebView _mayContainEditableElementsInRect:]): Deleted; moved to WKWebViewTestingIOS.mm.
+            (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Deleted; moved to WKContentViewInteraction.mm.
+            * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+            * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
+            * UIProcess/API/ios/WKWebViewTestingIOS.mm:
+            (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Added. Turns around and
+            calls the function of the same name on the WKContentView. It takes care to convert the specified
+            rect from WKWebView coordinates to WKContentView coordinates and fixes up the bounding rects
+            for the returned contexts to be in WKWebView coordinates. This keeps existings tests passing
+            as mekes using this function intuitive since callers specify and get rects in WKWebView coordinates.
+            (-[WKWebView _requestDocumentContext:completionHandler:]): Added.
+            (-[WKWebView _adjustSelectionWithDelta:completionHandler:]): Added.
+            (-[WKWebView _mayContainEditableElementsInRect:]): Moved from WKWebView.mm.
+            * UIProcess/ios/WKContentViewInteraction.h:
+            * UIProcess/ios/WKContentViewInteraction.mm:
+            (-[WKContentView _requestTextInputContextsInRect:completionHandler:]): Moved from WKWebView.mm and simplified.
+
+2020-04-16  Alan Coon  <[email protected]>
+
         Cherry-pick r260186. rdar://problem/61897760
 
     REGRESSION (r259898): WebKit-based Books views are all blank

Modified: branches/safari-610.1.10-branch/Source/WebKit/Platform/spi/ios/UIKitSPI.h (260210 => 260211)


--- branches/safari-610.1.10-branch/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2020-04-16 19:31:05 UTC (rev 260210)
+++ branches/safari-610.1.10-branch/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2020-04-16 19:31:10 UTC (rev 260211)
@@ -680,7 +680,13 @@
 @property (class, nonatomic, readonly) CGFloat _maximumBeamSnappingLength;
 @end
 
+@class UIWKDocumentRequest;
+@class UIWKDocumentContext;
+
 @protocol UIWKInteractionViewProtocol
+- (void)adjustSelectionWithDelta:(NSRange)deltaRange completionHandler:(void (^)(void))completionHandler;
+- (void)requestDocumentContext:(UIWKDocumentRequest *)request completionHandler:(void (^)(UIWKDocumentContext *))completionHandler;
+- (void)selectPositionAtPoint:(CGPoint)point withContextRequest:(UIWKDocumentRequest *)request completionHandler:(void (^)(UIWKDocumentContext *))completionHandler;
 - (void)changeSelectionWithGestureAt:(CGPoint)point withGesture:(UIWKGestureType)gestureType withState:(UIGestureRecognizerState)state;
 - (void)changeSelectionWithTouchAt:(CGPoint)point withSelectionTouch:(UIWKSelectionTouch)touch baseIsStart:(BOOL)baseIsStart withFlags:(UIWKSelectionFlags)flags;
 - (void)changeSelectionWithTouchesFrom:(CGPoint)from to:(CGPoint)to withGesture:(UIWKGestureType)gestureType withState:(UIGestureRecognizerState)gestureState;

Modified: branches/safari-610.1.10-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (260210 => 260211)


--- branches/safari-610.1.10-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2020-04-16 19:31:05 UTC (rev 260210)
+++ branches/safari-610.1.10-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2020-04-16 19:31:10 UTC (rev 260211)
@@ -150,7 +150,6 @@
 
 #if PLATFORM(IOS_FAMILY)
 #import "RemoteLayerTreeDrawingAreaProxy.h"
-#import "RemoteLayerTreeViews.h"
 #import "RemoteScrollingCoordinatorProxy.h"
 #import "UIKitSPI.h"
 #import "WKContentViewInteraction.h"
@@ -2072,73 +2071,6 @@
     }
 }
 
-- (CGRect)_convertRectFromRootViewCoordinates:(CGRect)rectInRootViewCoordinates
-{
-    // FIXME: It should be easier to talk about WKWebView coordinates in a consistent and cross-platform way.
-    // Currently, neither "root view" nor "window" mean "WKWebView coordinates" on both platforms.
-    // See https://webkit.org/b/193649 and related bugs.
-#if PLATFORM(IOS_FAMILY)
-    return [self convertRect:rectInRootViewCoordinates fromView:_contentView.get()];
-#else
-    return rectInRootViewCoordinates;
-#endif
-}
-
-- (CGRect)_convertRectToRootViewCoordinates:(CGRect)rectInWebViewCoordinates
-{
-#if PLATFORM(IOS_FAMILY)
-    return [self convertRect:rectInWebViewCoordinates toView:_contentView.get()];
-#else
-    return rectInWebViewCoordinates;
-#endif
-}
-
-- (BOOL)_mayContainEditableElementsInRect:(CGRect)rect
-{
-#if ENABLE(EDITABLE_REGION)
-#if PLATFORM(IOS_FAMILY)
-    if (![self usesStandardContentView])
-        return NO;
-#endif
-    CGRect rectInRootViewCoordinates = [self _convertRectToRootViewCoordinates:rect];
-    return WebKit::mayContainEditableElementsInRect(_contentView.get(), rectInRootViewCoordinates);
-#else
-    return NO;
-#endif
-}
-
-- (void)_requestTextInputContextsInRect:(CGRect)rectInWebViewCoordinates completionHandler:(void(^)(NSArray<_WKTextInputContext *> *))completionHandler
-{
-#if PLATFORM(IOS_FAMILY)
-    if (![self usesStandardContentView]) {
-        completionHandler(@[]);
-        return;
-    }
-#endif
-#if ENABLE(EDITABLE_REGION)
-    if (![self _mayContainEditableElementsInRect:rectInWebViewCoordinates]) {
-        completionHandler(@[]);
-        return;
-    }
-#endif
-
-    CGRect rectInRootViewCoordinates = [self _convertRectToRootViewCoordinates:rectInWebViewCoordinates];
-
-    auto weakSelf = WeakObjCPtr<WKWebView>(self);
-    _page->textInputContextsInRect(rectInRootViewCoordinates, [weakSelf, capturedCompletionHandler = makeBlockPtr(completionHandler)] (const Vector<WebCore::ElementContext>& contexts) {
-        RetainPtr<NSMutableArray> elements = adoptNS([[NSMutableArray alloc] initWithCapacity:contexts.size()]);
-
-        auto strongSelf = weakSelf.get();
-        for (const auto& context : contexts) {
-            WebCore::ElementContext contextWithWebViewBoundingRect = context;
-            contextWithWebViewBoundingRect.boundingRect = [strongSelf _convertRectFromRootViewCoordinates:context.boundingRect];
-            [elements addObject:adoptNS([[_WKTextInputContext alloc] _initWithTextInputContext:contextWithWebViewBoundingRect]).get()];
-        }
-
-        capturedCompletionHandler(elements.get());
-    });
-}
-
 - (void)_focusTextInputContext:(_WKTextInputContext *)textInputContext completionHandler:(void(^)(BOOL))completionHandler
 {
 #if PLATFORM(IOS_FAMILY)

Modified: branches/safari-610.1.10-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (260210 => 260211)


--- branches/safari-610.1.10-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2020-04-16 19:31:05 UTC (rev 260210)
+++ branches/safari-610.1.10-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h	2020-04-16 19:31:10 UTC (rev 260211)
@@ -335,8 +335,6 @@
 - (void)_resumeAllMediaPlayback;
 - (void)_closeAllMediaPresentations;
 
-- (BOOL)_mayContainEditableElementsInRect:(CGRect)rect;
-- (void)_requestTextInputContextsInRect:(CGRect)rect completionHandler:(void(^)(NSArray<_WKTextInputContext *> *))completionHandler WK_API_AVAILABLE(macos(10.15), ios(13.0));
 - (void)_focusTextInputContext:(_WKTextInputContext *)textInputElement completionHandler:(void(^)(BOOL))completionHandler WK_API_AVAILABLE(macos(10.15), ios(13.0));
 
 - (void)_takePDFSnapshotWithConfiguration:(WKSnapshotConfiguration *)snapshotConfiguration completionHandler:(void (^)(NSData *pdfSnapshotData, NSError *error))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));

Modified: branches/safari-610.1.10-branch/Source/WebKit/UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h (260210 => 260211)


--- branches/safari-610.1.10-branch/Source/WebKit/UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h	2020-04-16 19:31:05 UTC (rev 260210)
+++ branches/safari-610.1.10-branch/Source/WebKit/UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h	2020-04-16 19:31:10 UTC (rev 260211)
@@ -27,6 +27,10 @@
 
 #if TARGET_OS_IPHONE
 
+@class _WKTextInputContext;
+@class UIWKDocumentContext;
+@class UIWKDocumentRequest;
+
 @interface WKWebView (WKTestingIOS)
 
 @property (nonatomic, readonly) NSString *textContentTypeForTesting;
@@ -44,6 +48,11 @@
 - (void)_dismissFilePicker;
 - (void)selectFormAccessoryPickerRow:(int)rowIndex;
 
+- (BOOL)_mayContainEditableElementsInRect:(CGRect)rect;
+- (void)_requestTextInputContextsInRect:(CGRect)rect completionHandler:(void(^)(NSArray<_WKTextInputContext *> *))completionHandler;
+- (void)_requestDocumentContext:(UIWKDocumentRequest *)request completionHandler:(void (^)(UIWKDocumentContext *))completionHandler;
+- (void)_adjustSelectionWithDelta:(NSRange)deltaRange completionHandler:(void (^)(void))completionHandler;
+
 - (void)setTimePickerValueToHour:(NSInteger)hour minute:(NSInteger)minute;
 
 - (void)applyAutocorrection:(NSString *)newString toString:(NSString *)oldString withCompletionHandler:(void (^)(void))completionHandler;

Modified: branches/safari-610.1.10-branch/Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm (260210 => 260211)


--- branches/safari-610.1.10-branch/Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm	2020-04-16 19:31:05 UTC (rev 260210)
+++ branches/safari-610.1.10-branch/Source/WebKit/UIProcess/API/ios/WKWebViewTestingIOS.mm	2020-04-16 19:31:10 UTC (rev 260211)
@@ -29,14 +29,54 @@
 #if PLATFORM(IOS_FAMILY)
 
 #import "RemoteLayerTreeDrawingAreaProxy.h"
+#import "RemoteLayerTreeViews.h"
 #import "RemoteScrollingCoordinatorProxy.h"
+#import "UIKitSPI.h"
+#import "WKContentViewInteraction.h"
 #import "WKFullScreenWindowController.h"
 #import "WKWebViewIOS.h"
 #import "WebPageProxy.h"
 #import "_WKActivatedElementInfoInternal.h"
+#import "_WKTextInputContextInternal.h"
+#import <WebCore/ElementContext.h>
 
 @implementation WKWebView (WKTestingIOS)
 
+- (void)_requestTextInputContextsInRect:(CGRect)rect completionHandler:(void(^)(NSArray<_WKTextInputContext *> *))completionHandler
+{
+    // Adjust returned bounding rects to be in WKWebView coordinates.
+    auto adjustedRect = [self convertRect:rect toView:_contentView.get()];
+    [_contentView _requestTextInputContextsInRect:adjustedRect completionHandler:[weakSelf = WeakObjCPtr<WKWebView>(self), completionHandler = makeBlockPtr(completionHandler)](NSArray<_WKTextInputContext *> *contexts) {
+        auto strongSelf = weakSelf.get();
+        if (!strongSelf || !contexts.count) {
+            completionHandler(@[ ]);
+            return;
+        }
+        auto adjustedContexts = adoptNS([[NSMutableArray alloc] initWithCapacity:contexts.count]);
+        for (_WKTextInputContext *context in contexts) {
+            auto adjustedContext = context._textInputContext;
+            adjustedContext.boundingRect = [strongSelf convertRect:adjustedContext.boundingRect fromView:strongSelf->_contentView.get()];
+            [adjustedContexts addObject:adoptNS([[_WKTextInputContext alloc] _initWithTextInputContext:adjustedContext]).get()];
+        }
+        completionHandler(adjustedContexts.autorelease());
+    }];
+}
+
+- (void)_requestDocumentContext:(UIWKDocumentRequest *)request completionHandler:(void (^)(UIWKDocumentContext *))completionHandler
+{
+    [_contentView requestDocumentContext:request completionHandler:completionHandler];
+}
+
+- (void)_adjustSelectionWithDelta:(NSRange)deltaRange completionHandler:(void (^)(void))completionHandler
+{
+    [_contentView adjustSelectionWithDelta:deltaRange completionHandler:completionHandler];
+}
+
+- (BOOL)_mayContainEditableElementsInRect:(CGRect)rect
+{
+    return WebKit::mayContainEditableElementsInRect(_contentView.get(), [self convertRect:rect toView:_contentView.get()]);
+}
+
 - (void)keyboardAccessoryBarNext
 {
     [_contentView accessoryTab:YES];

Modified: branches/safari-610.1.10-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (260210 => 260211)


--- branches/safari-610.1.10-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2020-04-16 19:31:05 UTC (rev 260210)
+++ branches/safari-610.1.10-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2020-04-16 19:31:10 UTC (rev 260211)
@@ -567,6 +567,8 @@
 - (WKDrawingCoordinator *)_drawingCoordinator;
 #endif
 
+- (void)_requestTextInputContextsInRect:(CGRect)rect completionHandler:(void(^)(NSArray<_WKTextInputContext *> *))completionHandler;
+
 #if USE(TEXT_INTERACTION_ADDITIONS)
 - (void)_willBeginTextInteractionInTextInputContext:(_WKTextInputContext *)context;
 - (void)_didFinishTextInteractionInTextInputContext:(_WKTextInputContext *)context;

Modified: branches/safari-610.1.10-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (260210 => 260211)


--- branches/safari-610.1.10-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-04-16 19:31:05 UTC (rev 260210)
+++ branches/safari-610.1.10-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-04-16 19:31:10 UTC (rev 260211)
@@ -5078,6 +5078,26 @@
     return CGRectZero;
 }
 
+- (void)_requestTextInputContextsInRect:(CGRect)rect completionHandler:(void(^)(NSArray<_WKTextInputContext *> *))completionHandler
+{
+#if ENABLE(EDITABLE_REGION)
+    if (!WebKit::mayContainEditableElementsInRect(self, rect)) {
+        completionHandler(@[ ]);
+        return;
+    }
+#endif
+    _page->textInputContextsInRect(rect, [weakSelf = WeakObjCPtr<WKContentView>(self), completionHandler = makeBlockPtr(completionHandler)] (const Vector<WebCore::ElementContext>& contexts) {
+        auto strongSelf = weakSelf.get();
+        if (!strongSelf || contexts.isEmpty()) {
+            completionHandler(@[ ]);
+            return;
+        }
+        completionHandler(createNSArray(contexts, [] (const auto& context) {
+            return adoptNS([[_WKTextInputContext alloc] _initWithTextInputContext:context]);
+        }).get());
+    });
+}
+
 #if USE(TEXT_INTERACTION_ADDITIONS)
 
 - (void)_willBeginTextInteractionInTextInputContext:(_WKTextInputContext *)context

Modified: branches/safari-610.1.10-branch/Tools/ChangeLog (260210 => 260211)


--- branches/safari-610.1.10-branch/Tools/ChangeLog	2020-04-16 19:31:05 UTC (rev 260210)
+++ branches/safari-610.1.10-branch/Tools/ChangeLog	2020-04-16 19:31:10 UTC (rev 260211)
@@ -1,3 +1,103 @@
+2020-04-16  Alan Coon  <[email protected]>
+
+        Cherry-pick r260192. rdar://problem/61897737
+
+    Move -_requestTextInputContextsInRect to WKContentView to simplify implementation
+    https://bugs.webkit.org/show_bug.cgi?id=210398
+    <rdar://problem/61656931>
+    
+    Reviewed by Darin Adler.
+    
+    Source/WebKit:
+    
+    -_requestTextInputContextsInRect is not needed on Mac, but supporting it complicates
+    its implementation: it has to deal with coordinate space differences due to differences
+    in what is the root view on Mac and iOS + it has to know about iOS's custom content views.
+    While this function was in the "SPI" header, there is no software at Apple that was using
+    these outside of WebKit, and I will assume no non-Apple software was using them either.
+    Moving this function to WKContentView lets me simplify the implementation.
+    
+    * Platform/spi/ios/UIKitSPI.h: Add more forward declarations.
+    * UIProcess/API/Cocoa/WKWebView.mm:
+    (-[WKWebView _convertRectFromRootViewCoordinates:]): Deleted.
+    (-[WKWebView _convertRectToRootViewCoordinates:]): Deleted.
+    (-[WKWebView _mayContainEditableElementsInRect:]): Deleted; moved to WKWebViewTestingIOS.mm.
+    (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Deleted; moved to WKContentViewInteraction.mm.
+    * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+    * UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:
+    * UIProcess/API/ios/WKWebViewTestingIOS.mm:
+    (-[WKWebView _requestTextInputContextsInRect:completionHandler:]): Added. Turns around and
+    calls the function of the same name on the WKContentView. It takes care to convert the specified
+    rect from WKWebView coordinates to WKContentView coordinates and fixes up the bounding rects
+    for the returned contexts to be in WKWebView coordinates. This keeps existings tests passing
+    as mekes using this function intuitive since callers specify and get rects in WKWebView coordinates.
+    (-[WKWebView _requestDocumentContext:completionHandler:]): Added.
+    (-[WKWebView _adjustSelectionWithDelta:completionHandler:]): Added.
+    (-[WKWebView _mayContainEditableElementsInRect:]): Moved from WKWebView.mm.
+    * UIProcess/ios/WKContentViewInteraction.h:
+    * UIProcess/ios/WKContentViewInteraction.mm:
+    (-[WKContentView _requestTextInputContextsInRect:completionHandler:]): Moved from WKWebView.mm and simplified.
+    
+    Source/WTF:
+    
+    Add a convenience function to create an NSArray from a WTF::Vector with a transform function.
+    The tranform function can either return a RetainPtr or an id.
+    
+    * wtf/cocoa/VectorCocoa.h:
+    (WTF::createNSArray): Added.
+    
+    Tools:
+    
+    Update test now that -_requestTextInputContextsInRect has moved from WKWebView to WKContentView.
+    I expose new testing-only WKWebView SPI to access it on the content view.
+    
+    * TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm:
+    (-[TestWKWebView synchronouslyRequestDocumentContext:]): Added; due to category name change.
+    (-[TestWKWebView synchronouslyAdjustSelectionWithDelta:]): Added; due to category name change.
+    * TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm:
+    (-[WKWebView synchronouslyRequestTextInputContextsInRect:]): Deleted; due to category name change.
+    (-[WKWebView synchronouslyFocusTextInputContext:]): Deleted; due to category name change.
+    * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+    (WTR::UIScriptControllerIOS::mayContainEditableElementsInRect): Convert from content coordinates
+    to WKWebView coordinates now that -_mayContainEditableElementsInRect expects it.
+    
+    LayoutTests:
+    
+    Update test and expected results now that UIScriptController.mayContainEditableElementsInRect()
+    expects the passed rect to be in content coordinates.
+    
+    I replaced one sub-test of a rect pre-scroll with another that tests the location
+    of a rect that will have editable elements after scroll. The purpose of that sub-test
+    hasn't changed, but it now makes the sub-tests' rects symmetric for before and after
+    scroll. I also added debug() statements to demarcate the before scroll and after scroll
+    sub-tests in the results to make it easier to understand what this test file is testing.
+    
+    * editing/editable-region/hit-test-fixed-expected.txt:
+    * editing/editable-region/hit-test-fixed.html:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260192 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-04-16  Daniel Bates  <[email protected]>
+
+            Move -_requestTextInputContextsInRect to WKContentView to simplify implementation
+            https://bugs.webkit.org/show_bug.cgi?id=210398
+            <rdar://problem/61656931>
+
+            Reviewed by Darin Adler.
+
+            Update test now that -_requestTextInputContextsInRect has moved from WKWebView to WKContentView.
+            I expose new testing-only WKWebView SPI to access it on the content view.
+
+            * TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm:
+            (-[TestWKWebView synchronouslyRequestDocumentContext:]): Added; due to category name change.
+            (-[TestWKWebView synchronouslyAdjustSelectionWithDelta:]): Added; due to category name change.
+            * TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm:
+            (-[WKWebView synchronouslyRequestTextInputContextsInRect:]): Deleted; due to category name change.
+            (-[WKWebView synchronouslyFocusTextInputContext:]): Deleted; due to category name change.
+            * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+            (WTR::UIScriptControllerIOS::mayContainEditableElementsInRect): Convert from content coordinates
+            to WKWebView coordinates now that -_mayContainEditableElementsInRect expects it.
+
 2020-04-11  Wenson Hsieh  <[email protected]>
 
         [macOS] [WK1] Touch Bar flashes when typing in Vietnamese in Mail

Modified: branches/safari-610.1.10-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm (260210 => 260211)


--- branches/safari-610.1.10-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm	2020-04-16 19:31:05 UTC (rev 260210)
+++ branches/safari-610.1.10-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/DocumentEditingContext.mm	2020-04-16 19:31:10 UTC (rev 260211)
@@ -29,12 +29,9 @@
 
 #import "PlatformUtilities.h"
 #import "TestCocoa.h"
-#import "TestNavigationDelegate.h"
 #import "TestWKWebView.h"
 #import "UIKitSPI.h"
-#import <WebKit/WKPreferencesRefPrivate.h>
-#import <WebKit/WKWebViewPrivate.h>
-#import <WebKit/WebKit.h>
+#import <WebKit/WKWebViewPrivateForTesting.h>
 #import <WebKit/_WKTextInputContext.h>
 #import <wtf/RetainPtr.h>
 #import <wtf/Vector.h>
@@ -47,11 +44,6 @@
     EXPECT_TRUE([actual isKindOfClass:[NSAttributedString class]]); \
     EXPECT_WK_STREQ(expected, [(NSAttributedString *)actual string]);
 
-@interface WKContentView ()
-- (void)requestDocumentContext:(UIWKDocumentRequest *)request completionHandler:(void (^)(UIWKDocumentContext *))completionHandler;
-- (void)adjustSelectionWithDelta:(NSRange)deltaRange completionHandler:(void (^)(void))completionHandler;
-@end
-
 static UIWKDocumentRequest *makeRequest(UIWKDocumentRequestFlags flags, UITextGranularity granularity, NSInteger granularityCount, CGRect documentRect = CGRectZero, id <NSCopying> inputElementIdentifier = nil)
 {
     auto request = adoptNS([[UIWKDocumentRequest alloc] init]);
@@ -130,7 +122,7 @@
 {
     __block bool finished = false;
     __block RetainPtr<UIWKDocumentContext> result;
-    [[self wkContentView] requestDocumentContext:request completionHandler:^(UIWKDocumentContext *context) {
+    [self _requestDocumentContext:request completionHandler:^(UIWKDocumentContext *context) {
         result = context;
         finished = true;
     }];
@@ -141,7 +133,7 @@
 - (void)synchronouslyAdjustSelectionWithDelta:(NSRange)range
 {
     __block bool finished = false;
-    [[self wkContentView] adjustSelectionWithDelta:range completionHandler:^() {
+    [self _adjustSelectionWithDelta:range completionHandler:^() {
         finished = true;
     }];
     TestWebKitAPI::Util::run(&finished);

Modified: branches/safari-610.1.10-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm (260210 => 260211)


--- branches/safari-610.1.10-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm	2020-04-16 19:31:05 UTC (rev 260210)
+++ branches/safari-610.1.10-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm	2020-04-16 19:31:10 UTC (rev 260211)
@@ -25,17 +25,18 @@
 
 #import "config.h"
 
+#if PLATFORM(IOS_FAMILY)
+
 #import "PlatformUtilities.h"
 #import "TestCocoa.h"
 #import "TestNavigationDelegate.h"
 #import "TestWKWebView.h"
 #import <WebKit/WKPreferencesRefPrivate.h>
-#import <WebKit/WKWebViewPrivate.h>
-#import <WebKit/WebKit.h>
+#import <WebKit/WKWebViewPrivateForTesting.h>
 #import <WebKit/_WKTextInputContext.h>
 #import <wtf/RetainPtr.h>
 
-@implementation WKWebView (SynchronousTextInputContext)
+@implementation TestWKWebView (SynchronousTextInputContext)
 
 - (NSArray<_WKTextInputContext *> *)synchronouslyRequestTextInputContextsInRect:(CGRect)rect
 {
@@ -263,3 +264,5 @@
     [webView synchronouslyLoadHTMLString:@""];
     EXPECT_FALSE([webView synchronouslyFocusTextInputContext:textArea.get()]);
 }
+
+#endif // PLATFORM(IOS_FAMILY)

Modified: branches/safari-610.1.10-branch/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (260210 => 260211)


--- branches/safari-610.1.10-branch/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2020-04-16 19:31:05 UTC (rev 260210)
+++ branches/safari-610.1.10-branch/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2020-04-16 19:31:10 UTC (rev 260211)
@@ -838,7 +838,8 @@
 
 bool UIScriptControllerIOS::mayContainEditableElementsInRect(unsigned x, unsigned y, unsigned width, unsigned height)
 {
-    return [webView() _mayContainEditableElementsInRect:CGRectMake(x, y, width, height)];
+    auto contentRect = CGRectMake(x, y, width, height);
+    return [webView() _mayContainEditableElementsInRect:[webView() convertRect:contentRect fromView:platformContentView()]];
 }
 
 static UIDeviceOrientation toUIDeviceOrientation(DeviceOrientation* orientation)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to