Title: [260193] trunk
Revision
260193
Author
[email protected]
Date
2020-04-16 09:52:25 -0700 (Thu, 16 Apr 2020)

Log Message

REGRESSION (r259762): Should always hit test for editable elements if the WKWebView is fully editable
https://bugs.webkit.org/show_bug.cgi?id=210558
<rdar://problem/61798347>

Reviewed by Wenson Hsieh.

Source/WebKit:

If the entire WKWebView is marked editable (via SPI -[WKWebView _setEditable]) then
always ask the web process to hit test the page because every element is considered
editable.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _requestTextInputContextsInRect:completionHandler:]):

Tools:

Add a test.

* TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm:
(TEST):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (260192 => 260193)


--- trunk/Source/WebKit/ChangeLog	2020-04-16 16:47:54 UTC (rev 260192)
+++ trunk/Source/WebKit/ChangeLog	2020-04-16 16:52:25 UTC (rev 260193)
@@ -1,5 +1,20 @@
 2020-04-16  Daniel Bates  <[email protected]>
 
+        REGRESSION (r259762): Should always hit test for editable elements if the WKWebView is fully editable
+        https://bugs.webkit.org/show_bug.cgi?id=210558
+        <rdar://problem/61798347>
+
+        Reviewed by Wenson Hsieh.
+
+        If the entire WKWebView is marked editable (via SPI -[WKWebView _setEditable]) then
+        always ask the web process to hit test the page because every element is considered
+        editable.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _requestTextInputContextsInRect:completionHandler:]):
+
+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>

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (260192 => 260193)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-04-16 16:47:54 UTC (rev 260192)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-04-16 16:52:25 UTC (rev 260193)
@@ -5081,7 +5081,7 @@
 - (void)_requestTextInputContextsInRect:(CGRect)rect completionHandler:(void(^)(NSArray<_WKTextInputContext *> *))completionHandler
 {
 #if ENABLE(EDITABLE_REGION)
-    if (!WebKit::mayContainEditableElementsInRect(self, rect)) {
+    if (!self.webView._editable && !WebKit::mayContainEditableElementsInRect(self, rect)) {
         completionHandler(@[ ]);
         return;
     }

Modified: trunk/Tools/ChangeLog (260192 => 260193)


--- trunk/Tools/ChangeLog	2020-04-16 16:47:54 UTC (rev 260192)
+++ trunk/Tools/ChangeLog	2020-04-16 16:52:25 UTC (rev 260193)
@@ -1,5 +1,18 @@
 2020-04-16  Daniel Bates  <[email protected]>
 
+        REGRESSION (r259762): Should always hit test for editable elements if the WKWebView is fully editable
+        https://bugs.webkit.org/show_bug.cgi?id=210558
+        <rdar://problem/61798347>
+
+        Reviewed by Wenson Hsieh.
+
+        Add a test.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm:
+        (TEST):
+
+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>

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm (260192 => 260193)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm	2020-04-16 16:47:54 UTC (rev 260192)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/RequestTextInputContext.mm	2020-04-16 16:52:25 UTC (rev 260193)
@@ -185,6 +185,15 @@
     EXPECT_EQ(CGRectMake(0, 200, 100, 100), contexts[0].boundingRect);
 }
 
+TEST(RequestTextInputContext, ViewIsEditable)
+{
+    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+    [webView synchronouslyLoadHTMLString:applyStyle(@"<body></body>")];
+    [webView _setEditable:YES];
+    EXPECT_GE([webView synchronouslyRequestTextInputContextsInRect:[webView bounds]].count, 1UL);
+}
+
 static CGRect squareCenteredAtPoint(float x, float y, float length)
 {
     return CGRectMake(x - length / 2, y - length / 2, length, length);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to