Cannot click "Next" button on Google two-factor auth setup page
authorjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Apr 2015 19:52:11 +0000 (19:52 +0000)
committerjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Apr 2015 19:52:11 +0000 (19:52 +0000)
<https://bugs.webkit.org/show_bug.cgi?id=143624>
<rdar://problem/19175714>

.:

Reviewed by Darin Adler.

* ManualTests/button-that-focuses-itself-on-click.html: Added.

Source/WebKit2:

This issue occurs when this site focuses the submit button. When it
receives focus, we try to assist it. While we consider ourselves to be
assisting it, we ignore further gesture inputs for that node, including
the tap gesture.

To fix this, only assist input types that we know are assistable,
including text fields, select and date elements, etc.

Reviewed by Darin Adler.

* UIProcess/ios/WKContentViewInteraction.mm:
(isAssistableInputType):
If the type is a known-assistable type, return true.
(-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]):
Call isAssistableInputType() to determine whether we should do any kind
of assistance for this node.

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

ChangeLog
ManualTests/button-that-focuses-itself-on-click.html [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm

index b714341..6d8908f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2015-04-10  Jon Honeycutt  <jhoneycutt@apple.com>
+
+        Cannot click "Next" button on Google two-factor auth setup page
+
+        <https://bugs.webkit.org/show_bug.cgi?id=143624>
+        <rdar://problem/19175714>
+
+        Reviewed by Darin Adler.
+
+        * ManualTests/button-that-focuses-itself-on-click.html: Added.
+
 2015-04-13  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         [cmake] REGRESSION(182663): It broke feature dependency handling
diff --git a/ManualTests/button-that-focuses-itself-on-click.html b/ManualTests/button-that-focuses-itself-on-click.html
new file mode 100644 (file)
index 0000000..3d5d93a
--- /dev/null
@@ -0,0 +1,33 @@
+<head>
+    <meta name="viewport" content="width=device-width">
+    <script>
+        var haveClicked = false;
+        function runTest(e) {
+            if (haveClicked) {
+                e.value = "Test passed";
+                e.disabled = true;
+                return;
+            }
+            e.value = "Click me again";
+            e.focus();
+            haveClicked = true;
+        }
+    </script>
+</head>
+
+<body>
+    <center>
+        <input type=submit onclick="runTest(this); return false;" value="Click me" style="font-size: 36px">
+    </center>
+    <br><br>
+    <div style="font-size: 20px; font-family: helvetica;">
+        Test for WebKit bug #<a href="https://bugs.webkit.org/show_bug.cgi?id=143624">143624</a>
+        <br><br>
+        Tap button above twice to run test. &ldquo;Test passed&rdquo; will
+        appear above if the test passes. If you cannot click the button a
+        second time, the test failed.
+        <br><br>
+        To rerun this test, open it in a new tab. Do not reload.
+    </div>
+</body>
+
index ac0317e..d7b1dec 100644 (file)
@@ -1,3 +1,27 @@
+2015-04-10  Jon Honeycutt  <jhoneycutt@apple.com>
+
+        Cannot click "Next" button on Google two-factor auth setup page
+
+        <https://bugs.webkit.org/show_bug.cgi?id=143624>
+        <rdar://problem/19175714>
+
+        This issue occurs when this site focuses the submit button. When it
+        receives focus, we try to assist it. While we consider ourselves to be
+        assisting it, we ignore further gesture inputs for that node, including
+        the tap gesture.
+
+        To fix this, only assist input types that we know are assistable,
+        including text fields, select and date elements, etc.
+
+        Reviewed by Darin Adler.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (isAssistableInputType):
+        If the type is a known-assistable type, return true.
+        (-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]):
+        Call isAssistableInputType() to determine whether we should do any kind
+        of assistance for this node.
+
 2015-04-13  Beth Dakin  <bdakin@apple.com>
 
         Add force property to MouseEvents
index da72dec..679dac2 100644 (file)
@@ -2765,6 +2765,36 @@ static UITextAutocapitalizationType toUITextAutocapitalize(WebAutocapitalizeType
     return _formAccessoryView.get();
 }
 
+static bool isAssistableInputType(InputType type)
+{
+    switch (type) {
+    case InputType::ContentEditable:
+    case InputType::Text:
+    case InputType::Password:
+    case InputType::TextArea:
+    case InputType::Search:
+    case InputType::Email:
+    case InputType::URL:
+    case InputType::Phone:
+    case InputType::Number:
+    case InputType::NumberPad:
+    case InputType::Date:
+    case InputType::DateTime:
+    case InputType::DateTimeLocal:
+    case InputType::Month:
+    case InputType::Week:
+    case InputType::Time:
+    case InputType::Select:
+        return true;
+
+    case InputType::None:
+        return false;
+    }
+
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
 - (void)_startAssistingNode:(const AssistedNodeInformation&)information userIsInteracting:(BOOL)userIsInteracting blurPreviousNode:(BOOL)blurPreviousNode userObject:(NSObject <NSSecureCoding> *)userObject
 {
     if (!userIsInteracting && !_textSelectionAssistant)
@@ -2773,6 +2803,9 @@ static UITextAutocapitalizationType toUITextAutocapitalize(WebAutocapitalizeType
     if (blurPreviousNode)
         [self _stopAssistingNode];
 
+    if (!isAssistableInputType(information.elementType))
+        return;
+
     // FIXME: We should remove this check when we manage to send StartAssistingNode from the WebProcess
     // only when it is truly time to show the keyboard.
     if (_assistedNodeInformation.elementType == information.elementType && _assistedNodeInformation.elementRect == information.elementRect)