Don't retain focus for input peripheral views
authormegan_gardner@apple.com <megan_gardner@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 27 Jan 2018 02:13:48 +0000 (02:13 +0000)
committermegan_gardner@apple.com <megan_gardner@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 27 Jan 2018 02:13:48 +0000 (02:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=182204

Reviewed by Tim Horton.

Source/WebKit:

Retaining focus on input peripheral views makes it so they cannot dismiss themselves with
the current architecture. This should probably be fixed in UIKit, as there is no reason for
focus to be retained on these views anyways, as they don't have keyboard input, but this
guards against over-aggressive retain requests.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _restoreFocusWithToken:]):
(-[WKContentView _preserveFocusWithToken:destructively:]):

LayoutTests:

Fixed a spelling error while fixing a bug this test caught.

* fast/forms/ios/ipad/unfocus-inside-fixed-hittest.html:
* fast/forms/ios/ipad/unfocus-inside-fixed-hittest-expected.txt:

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

LayoutTests/ChangeLog
LayoutTests/fast/forms/ios/ipad/unfocus-inside-fixed-hittest-expected.txt
LayoutTests/fast/forms/ios/ipad/unfocus-inside-fixed-hittest.html
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

index d53e9db03ed3b8925abeb0b10101dd20545bded1..9409a4342d5fe02996c894b54c60d63f5ce54318 100644 (file)
@@ -1,3 +1,15 @@
+2018-01-26  Megan Gardner  <megan_gardner@apple.com>
+
+        Don't retain focus for input peripheral views
+        https://bugs.webkit.org/show_bug.cgi?id=182204
+
+        Reviewed by Tim Horton.
+
+        Fixed a spelling error while fixing a bug this test caught.
+
+        * fast/forms/ios/ipad/unfocus-inside-fixed-hittest.html:
+        * fast/forms/ios/ipad/unfocus-inside-fixed-hittest-expected.txt:
+
 2018-01-26  Youenn Fablet  <youenn@apple.com>
 
         Layout Test imported/w3c/web-platform-tests/service-workers/service-worker/appcache-ordering-main.https.html is flaky
index 0c31274ad6e724c5b639f04d2cddeb373fa0540c..d511b65d787f21aef3d514a12bfae190ce15d342 100644 (file)
@@ -2,4 +2,4 @@ This is the top
 
 Click Me
 June
-PASS: hit testing found #target after select interation
+PASS: hit testing found #target after select interaction
index 9e236b94ea8bc675ca654454286bce90cca2a5f6..86b240564f5461865968b40bc69b428542f971cc 100644 (file)
@@ -76,7 +76,7 @@
         var clicked = false;
         function buttonClicked()
         {
-            document.getElementById('result').textContent = 'PASS: hit testing found #target after select interation';
+            document.getElementById('result').textContent = 'PASS: hit testing found #target after select interaction';
             if (window.testRunner)
                 testRunner.notifyDone();
         }
index 92b293ee3c96859fb67cc5510f0a4c8b679530d8..2287815f752413b0461d2d08b07d002a5e29b55f 100644 (file)
@@ -1,3 +1,19 @@
+2018-01-26  Megan Gardner  <megan_gardner@apple.com>
+
+        Don't retain focus for input peripheral views
+        https://bugs.webkit.org/show_bug.cgi?id=182204
+
+        Reviewed by Tim Horton.
+
+        Retaining focus on input peripheral views makes it so they cannot dismiss themselves with
+        the current architecture. This should probably be fixed in UIKit, as there is no reason for
+        focus to be retained on these views anyways, as they don't have keyboard input, but this
+        guards against over-aggressive retain requests.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _restoreFocusWithToken:]):
+        (-[WKContentView _preserveFocusWithToken:destructively:]):
+
 2018-01-26  Chris Dumez  <cdumez@apple.com>
 
         Make sure service worker code does not launch a StorageProcess unnecessarily
index a1fb9234f72cbf69652d8a293c4e182430ef630d..a339190f790cde1722e149c1032aadcaac451a0b 100644 (file)
@@ -4169,12 +4169,14 @@ static bool isAssistableInputType(InputType type)
 
 - (void)_restoreFocusWithToken:(id <NSCopying, NSSecureCoding>)token
 {
-    --_webView->_activeFocusedStateRetainCount;
+    if (!_inputPeripheral)
+        --_webView->_activeFocusedStateRetainCount;
 }
 
 - (void)_preserveFocusWithToken:(id <NSCopying, NSSecureCoding>)token destructively:(BOOL)destructively
 {
-    ++_webView->_activeFocusedStateRetainCount;
+    if (!_inputPeripheral)
+        ++_webView->_activeFocusedStateRetainCount;
 }
 
 #pragma mark - Implementation of UIWebTouchEventsGestureRecognizerDelegate.