Caps lock indicator should not be shown in read-only or disabled field
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Jun 2015 22:35:44 +0000 (22:35 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Jun 2015 22:35:44 +0000 (22:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145612
<rdar://problem/21227454>

Reviewed by Darin Adler.

.:

* ManualTests/password-caps-lock-should-not-show-in-read-only-field.html: Added.
* ManualTests/password-caps-lock-should-not-show-when-field-becomes-disabled.html: Added.
* ManualTests/password-caps-lock-should-not-show-when-field-becomes-read-only.html: Added.

Source/WebCore:

* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::disabledAttributeChanged): Update caps lock indicator state.
(WebCore::TextFieldInputType::readonlyAttributeChanged): Ditto.
(WebCore::TextFieldInputType::shouldDrawCapsLockIndicator): Do not draw the caps lock indicator
when the field is read-only or disabled.

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

ChangeLog
ManualTests/password-caps-lock-should-not-show-in-read-only-field.html [new file with mode: 0644]
ManualTests/password-caps-lock-should-not-show-when-field-becomes-disabled.html [new file with mode: 0644]
ManualTests/password-caps-lock-should-not-show-when-field-becomes-read-only.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/TextFieldInputType.cpp

index 70415a8..87a6562 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2015-06-03  Daniel Bates  <dabates@apple.com>
+
+        Caps lock indicator should not be shown in read-only or disabled field
+        https://bugs.webkit.org/show_bug.cgi?id=145612
+        <rdar://problem/21227454>
+
+        Reviewed by Darin Adler.
+
+        * ManualTests/password-caps-lock-should-not-show-in-read-only-field.html: Added.
+        * ManualTests/password-caps-lock-should-not-show-when-field-becomes-disabled.html: Added.
+        * ManualTests/password-caps-lock-should-not-show-when-field-becomes-read-only.html: Added.
+
 2015-06-01  Csaba Osztrogon√°c  <ossy@webkit.org>
 
         [cmake] Suppress parentheses-equality warnings
diff --git a/ManualTests/password-caps-lock-should-not-show-in-read-only-field.html b/ManualTests/password-caps-lock-should-not-show-in-read-only-field.html
new file mode 100644 (file)
index 0000000..6738c94
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This test can be used to verify that the caps lock indicator is not shown in a read-only password field.</p>
+<ol>
+    <li>Click on the password field (below) to focus it.</li>
+    <li>Press the caps lock key on the keyboard.</li>
+</ol>
+<p>This test FAILED if the caps lock indicator is shown. Otherwise, it PASSED.</p>
+<input type="password" readonly>
+</body>
+</html>
diff --git a/ManualTests/password-caps-lock-should-not-show-when-field-becomes-disabled.html b/ManualTests/password-caps-lock-should-not-show-when-field-becomes-disabled.html
new file mode 100644 (file)
index 0000000..8ea6163
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This test can be used to verify that the caps lock indicator is not shown when the password field becomes disabled.</p>
+<ol>
+    <li>Click on the password field (below) to focus it.</li>
+    <li>Press the caps lock key on the keyboard.</li>
+</ol>
+<p>This test FAILED if the caps lock indicator is shown. Otherwise, it PASSED.</p>
+<input type="password" onkeydown="this.disabled = true;"> <!-- AppKit only dispatches a keydown event when the caps lock key is enabled. -->
+</body>
+</html>
diff --git a/ManualTests/password-caps-lock-should-not-show-when-field-becomes-read-only.html b/ManualTests/password-caps-lock-should-not-show-when-field-becomes-read-only.html
new file mode 100644 (file)
index 0000000..33f0f91
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This test can be used to verify that the caps lock indicator is not shown when the password field becomes read-only.</p>
+<ol>
+    <li>Click on the password field (below) to focus it.</li>
+    <li>Press the caps lock key on the keyboard.</li>
+</ol>
+<p>This test FAILED if the caps lock indicator is shown. Otherwise, it PASSED.</p>
+<input type="password" onkeydown="this.readOnly = true;"> <!-- AppKit only dispatches a keydown event when the caps lock key is enabled. -->
+</body>
+</html>
index f4e5f86..40d8d7a 100644 (file)
@@ -1,3 +1,17 @@
+2015-06-03  Daniel Bates  <dabates@apple.com>
+
+        Caps lock indicator should not be shown in read-only or disabled field
+        https://bugs.webkit.org/show_bug.cgi?id=145612
+        <rdar://problem/21227454>
+
+        Reviewed by Darin Adler.
+
+        * html/TextFieldInputType.cpp:
+        (WebCore::TextFieldInputType::disabledAttributeChanged): Update caps lock indicator state.
+        (WebCore::TextFieldInputType::readonlyAttributeChanged): Ditto.
+        (WebCore::TextFieldInputType::shouldDrawCapsLockIndicator): Do not draw the caps lock indicator
+        when the field is read-only or disabled.
+
 2015-06-03  Dean Jackson  <dino@apple.com>
 
         Crash in GraphicsContext3D::getInternalFramebufferSize
index e7ecf6f..d369daa 100644 (file)
@@ -358,6 +358,7 @@ void TextFieldInputType::disabledAttributeChanged()
 {
     if (m_innerSpinButton)
         m_innerSpinButton->releaseCapture();
+    capsLockStateMayHaveChanged();
     updateAutoFillButton();
 }
 
@@ -365,6 +366,7 @@ void TextFieldInputType::readonlyAttributeChanged()
 {
     if (m_innerSpinButton)
         m_innerSpinButton->releaseCapture();
+    capsLockStateMayHaveChanged();
     updateAutoFillButton();
 }
 
@@ -551,6 +553,9 @@ bool TextFieldInputType::shouldDrawCapsLockIndicator() const
     if (element().document().focusedElement() != &element())
         return false;
 
+    if (element().isDisabledOrReadOnly())
+        return false;
+
     Frame* frame = element().document().frame();
     if (!frame)
         return false;