Title: [238513] trunk
Revision
238513
Author
[email protected]
Date
2018-11-26 12:42:22 -0800 (Mon, 26 Nov 2018)

Log Message

REGRESSION (r238078): Do not draw caps lock indicator when Strong Password button is shown
https://bugs.webkit.org/show_bug.cgi?id=191969
<rdar://problem/46247569>

Reviewed by Dean Jackson.

Source/WebCore:

Following r238078 we now support drawing the caps lock indicator in password fields on iOS.
However it is not meaningful to show the caps lock indicator when the Strong Password button
is visible because the password field is not editable. We should not paint the caps lock
indicator when the Strong Password button is visible.

Tests: fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-when-after-hiding-auto-fill-strong-password-button.html
       fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible.html

* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::shouldDrawCapsLockIndicator const): Do not draw the caps
lock indicator when the password field has the Strong Password button.
(WebCore::TextFieldInputType::updateAutoFillButton): Call capsLockStateMayHaveChanged() to
update the visibility of the caps lock indicator when the auto fill button has changed.

LayoutTests:

Add tests to ensure that we show or hide the caps lock indicator depending on whether the
Strong Password button is visible.

* TestExpectations: Skip the tests below on all platforms. We will selectively enable them on Mac.
* fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-when-after-hiding-auto-fill-strong-password-button-expected.html: Added.
* fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-when-after-hiding-auto-fill-strong-password-button.html: Added.
* fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible-expected.html: Added.
* fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible.html: Added.
* platform/mac-wk2/TestExpectations: Mark the tests above as PASS so that we run them.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238512 => 238513)


--- trunk/LayoutTests/ChangeLog	2018-11-26 20:41:19 UTC (rev 238512)
+++ trunk/LayoutTests/ChangeLog	2018-11-26 20:42:22 UTC (rev 238513)
@@ -1,5 +1,23 @@
 2018-11-26  Daniel Bates  <[email protected]>
 
+        REGRESSION (r238078): Do not draw caps lock indicator when Strong Password button is shown
+        https://bugs.webkit.org/show_bug.cgi?id=191969
+        <rdar://problem/46247569>
+
+        Reviewed by Dean Jackson.
+
+        Add tests to ensure that we show or hide the caps lock indicator depending on whether the
+        Strong Password button is visible.
+
+        * TestExpectations: Skip the tests below on all platforms. We will selectively enable them on Mac.
+        * fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-when-after-hiding-auto-fill-strong-password-button-expected.html: Added.
+        * fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-when-after-hiding-auto-fill-strong-password-button.html: Added.
+        * fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible-expected.html: Added.
+        * fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible.html: Added.
+        * platform/mac-wk2/TestExpectations: Mark the tests above as PASS so that we run them.
+
+2018-11-26  Daniel Bates  <[email protected]>
+
         Move testRunner.toggleCapsLock() to uiController
         https://bugs.webkit.org/show_bug.cgi?id=191972
 

Modified: trunk/LayoutTests/TestExpectations (238512 => 238513)


--- trunk/LayoutTests/TestExpectations	2018-11-26 20:41:19 UTC (rev 238512)
+++ trunk/LayoutTests/TestExpectations	2018-11-26 20:42:22 UTC (rev 238513)
@@ -399,6 +399,8 @@
 fast/misc/valid-primary-screen-displayID.html [ Skip ]
 
 fast/events/detect-caps-lock.html [ Skip ]
+fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-when-after-hiding-auto-fill-strong-password-button.html [ Skip ]
+fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible.html [ Skip ]
 
 # This test currently only works for mac-wk2
 fast/events/inactive-window-no-mouse-event.html [ Skip ]

Added: trunk/LayoutTests/fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-when-after-hiding-auto-fill-strong-password-button-expected.html (0 => 238513)


--- trunk/LayoutTests/fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-when-after-hiding-auto-fill-strong-password-button-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-when-after-hiding-auto-fill-strong-password-button-expected.html	2018-11-26 20:42:22 UTC (rev 238513)
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+if (window.testRunner)
+    testRunner.waitUntilDone();
+</script>
+</head>
+<body>
+<p>This tests that the caps lock indicator is visible after hiding the Strong Password AutoFill button. It can only be tested in the test tool.</p>
+<input type="password" value="A quick brown fox jumped over the lazy dog.">
+<script>
+function done()
+{
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+function handleCapsLockEnabled(event)
+{
+    console.assert(event.key === "CapsLock");
+    // FIXME: For some reason it takes up to 100ms for the caps lock indicator to be painted (why?).
+    window.setTimeout(done, 100);
+}
+
+async function runTest()
+{
+    if (!window.testRunner)
+        return;
+
+    let input = document.querySelector("input");
+
+    function handleFocus(event) {
+        console.assert(event.target === input);
+        // Move the caret is at the beginning of the field to ensure consistent test results.
+        input.setSelectionRange(0, 0);
+        input.addEventListener("keydown", handleCapsLockEnabled, { once: true });
+        UIHelper.toggleCapsLock();
+    }
+    input.addEventListener("focus", handleFocus, { once: true });
+    UIHelper.activateElement(input); // Puts caret in the center of the field; we will fix this up.
+}
+
+runTest();
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-when-after-hiding-auto-fill-strong-password-button.html (0 => 238513)


--- trunk/LayoutTests/fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-when-after-hiding-auto-fill-strong-password-button.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-when-after-hiding-auto-fill-strong-password-button.html	2018-11-26 20:42:22 UTC (rev 238513)
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+if (window.testRunner)
+    testRunner.waitUntilDone();
+</script>
+</head>
+<body>
+<p>This tests that the caps lock indicator is visible after hiding the Strong Password AutoFill button. It can only be tested in the test tool.</p>
+<input type="password" value="A quick brown fox jumped over the lazy dog.">
+<script>
+function done()
+{
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+function handleCapsLockEnabled(event)
+{
+    console.assert(event.key === "CapsLock");
+    let input = document.querySelector("input");
+    internals.setAutofilled(input, false);
+    internals.setShowAutoFillButton(input, "None");
+
+    // Move the caret is at the beginning of the field to ensure consistent test results.
+    input.setSelectionRange(0, 0);
+
+    // FIXME: For some reason it takes up to 100ms for the caps lock indicator to be painted (why?).
+    window.setTimeout(done, 100);
+}
+
+async function runTest()
+{
+    if (!window.internals)
+        return;
+
+    let input = document.querySelector("input");
+    internals.setAutofilled(input, true);
+    internals.setShowAutoFillButton(input, "StrongPassword");
+
+    function handleFocus(event) {
+        console.assert(event.target === input);
+        input.addEventListener("keydown", handleCapsLockEnabled, { once: true });
+        UIHelper.toggleCapsLock();
+    }
+    input.addEventListener("focus", handleFocus, { once: true });
+    UIHelper.activateElement(input);
+}
+
+runTest();
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible-expected.html (0 => 238513)


--- trunk/LayoutTests/fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible-expected.html	2018-11-26 20:42:22 UTC (rev 238513)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+if (window.testRunner)
+    testRunner.waitUntilDone();
+</script>
+</head>
+<body>
+<p>This tests that the caps lock indicator is not visible when the Strong Password AutoFill button is shown. It can only be tested in the test tool.</p>
+<input type="password" value="A quick brown fox jumped over the lazy dog.">
+<script>
+async function runTest()
+{
+    if (!window.internals)
+        return;
+
+    let input = document.querySelector("input");
+    internals.setAutofilled(input, true);
+    internals.setShowAutoFillButton(input, "StrongPassword");
+
+    input.addEventListener("focus", () => testRunner.notifyDone(), { once: true });
+    await UIHelper.activateElement(input);
+}
+
+runTest();
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible.html (0 => 238513)


--- trunk/LayoutTests/fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible.html	2018-11-26 20:42:22 UTC (rev 238513)
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+if (window.testRunner)
+    testRunner.waitUntilDone();
+</script>
+</head>
+<body>
+<p>This tests that the caps lock indicator is not visible when the Strong Password AutoFill button is shown. It can only be tested in the test tool.</p>
+<input type="password" value="A quick brown fox jumped over the lazy dog.">
+<script>
+function done()
+{
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+function handleCapsLockEnabled(event)
+{
+    console.assert(event.key === "CapsLock");
+    // FIXME: For some reason it takes up to 100ms for the caps lock indicator to be painted (why?).
+    window.setTimeout(done, 100);
+}
+
+async function runTest()
+{
+    if (!window.internals)
+        return;
+
+    let input = document.querySelector("input");
+    internals.setAutofilled(input, true);
+    internals.setShowAutoFillButton(input, "StrongPassword");
+
+    function handleFocus(event) {
+        console.assert(event.target === input);
+        input.addEventListener("keydown", handleCapsLockEnabled, { once: true });
+        UIHelper.toggleCapsLock();
+    }
+    input.addEventListener("focus", handleFocus, { once: true });
+    UIHelper.activateElement(input);
+}
+
+runTest();
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (238512 => 238513)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2018-11-26 20:41:19 UTC (rev 238512)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2018-11-26 20:42:22 UTC (rev 238513)
@@ -68,6 +68,8 @@
 webkit.org/b/184569 storage/indexeddb/modern/transactions-stop-on-navigation.html [ Pass Failure ]
 
 [ Mojave+ ] fast/events/detect-caps-lock.html [ Pass ]
+[ Mojave+ ] fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-when-after-hiding-auto-fill-strong-password-button.html [ Pass ]
+[ Mojave+ ] fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible.html [ Pass ]
 
 fast/events/inactive-window-no-mouse-event.html [ Pass ]
 

Modified: trunk/Source/WebCore/ChangeLog (238512 => 238513)


--- trunk/Source/WebCore/ChangeLog	2018-11-26 20:41:19 UTC (rev 238512)
+++ trunk/Source/WebCore/ChangeLog	2018-11-26 20:42:22 UTC (rev 238513)
@@ -1,3 +1,25 @@
+2018-11-26  Daniel Bates  <[email protected]>
+
+        REGRESSION (r238078): Do not draw caps lock indicator when Strong Password button is shown
+        https://bugs.webkit.org/show_bug.cgi?id=191969
+        <rdar://problem/46247569>
+
+        Reviewed by Dean Jackson.
+
+        Following r238078 we now support drawing the caps lock indicator in password fields on iOS.
+        However it is not meaningful to show the caps lock indicator when the Strong Password button
+        is visible because the password field is not editable. We should not paint the caps lock
+        indicator when the Strong Password button is visible.
+
+        Tests: fast/forms/auto-fill-button/caps-lock-indicator-should-be-visible-when-after-hiding-auto-fill-strong-password-button.html
+               fast/forms/auto-fill-button/caps-lock-indicator-should-not-be-visible-when-auto-fill-strong-password-button-is-visible.html
+
+        * html/TextFieldInputType.cpp:
+        (WebCore::TextFieldInputType::shouldDrawCapsLockIndicator const): Do not draw the caps
+        lock indicator when the password field has the Strong Password button.
+        (WebCore::TextFieldInputType::updateAutoFillButton): Call capsLockStateMayHaveChanged() to
+        update the visibility of the caps lock indicator when the auto fill button has changed.
+
 2018-11-26  Sam Weinig  <[email protected]>
 
         Streamline ListHashSet use in floating object code

Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (238512 => 238513)


--- trunk/Source/WebCore/html/TextFieldInputType.cpp	2018-11-26 20:41:19 UTC (rev 238512)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp	2018-11-26 20:42:22 UTC (rev 238513)
@@ -724,6 +724,9 @@
     if (element()->isDisabledOrReadOnly())
         return false;
 
+    if (element()->hasAutoFillStrongPasswordButton())
+        return false;
+
     RefPtr<Frame> frame = element()->document().frame();
     if (!frame)
         return false;
@@ -792,6 +795,8 @@
 
 void TextFieldInputType::updateAutoFillButton()
 {
+    capsLockStateMayHaveChanged();
+
     if (shouldDrawAutoFillButton()) {
         if (!m_container)
             createContainer();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to