WebCore:
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 May 2008 17:11:46 +0000 (17:11 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 May 2008 17:11:46 +0000 (17:11 +0000)
        Bug 18900: Password field has focus but can't type text (i.rememberthemilk.com)
        <https://bugs.webkit.org/show_bug.cgi?id=18900>

        Original patch by Aaron Golden and Tim Omernick.  Reviewed by Adele.

        Test: fast/forms/textfield-to-password-on-focus.html

        * html/HTMLInputElement.cpp:
        (WebCore::HTMLInputElement::setInputType): If the current node has
        focus, call updateFocusAppearance() to make sure its state is correct
        after changing its type.

LayoutTests:

        Bug 18900: Password field has focus but can't type text (i.rememberthemilk.com)
        <https://bugs.webkit.org/show_bug.cgi?id=18900>

        Reviewed by Adele.

        * fast/forms/textfield-to-password-on-focus-expected.txt: Added.
        * fast/forms/textfield-to-password-on-focus.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/forms/textfield-to-password-on-focus-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/textfield-to-password-on-focus.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/html/HTMLInputElement.cpp

index bee5776..a25205f 100644 (file)
@@ -1,3 +1,13 @@
+2008-05-07  David Kilzer  <ddkilzer@apple.com>
+
+        Bug 18900: Password field has focus but can't type text (i.rememberthemilk.com)
+        <https://bugs.webkit.org/show_bug.cgi?id=18900>
+
+        Reviewed by Adele.
+
+        * fast/forms/textfield-to-password-on-focus-expected.txt: Added.
+        * fast/forms/textfield-to-password-on-focus.html: Added.
+
 2008-05-07  Tor Arne Vestbø  <tavestbo@trolltech.com>
 
         Reviewed by Simon
diff --git a/LayoutTests/fast/forms/textfield-to-password-on-focus-expected.txt b/LayoutTests/fast/forms/textfield-to-password-on-focus-expected.txt
new file mode 100644 (file)
index 0000000..75b6349
--- /dev/null
@@ -0,0 +1,13 @@
+Hit Tab key to focus input field.
+Type some text.
+
+Test for Bug 18900: Password field has focus but can't type text (i.rememberthemilk.com)
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS field.value is 'pass'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/forms/textfield-to-password-on-focus.html b/LayoutTests/fast/forms/textfield-to-password-on-focus.html
new file mode 100644 (file)
index 0000000..16a4c6f
--- /dev/null
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>    
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+<script>
+if (window.layoutTestController) {
+    window.layoutTestController.waitUntilDone();
+    window.layoutTestController.dumpAsText();
+}
+
+function changeToPasswordField(textField)
+{
+    textField.setAttribute("type", "password");
+}
+
+function test()
+{
+    if (window.layoutTestController) {
+        var field = document.getElementById("field").focus();
+
+        eventSender.keyDown("p");
+        eventSender.keyDown("a");
+        eventSender.keyDown("s");
+        eventSender.keyDown("s");
+
+        shouldBe('field.value', "'pass'");
+        isSuccessfullyParsed();
+
+        window.layoutTestController.notifyDone();
+    }
+}
+</script>
+</head>
+<body onload="test()">
+<ol><li>Hit Tab key to focus input field.</li><li>Type some text.</li></ol>
+<input type="text" id="field" onfocus="changeToPasswordField(this)">
+<hr>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("Test for <a href=\"https://bugs.webkit.org/show_bug.cgi?id=18900\">Bug 18900: Password field has focus but can't type text (i.rememberthemilk.com)</a>");
+successfullyParsed = true;
+</script>
+<script src="../js/resources/js-test-post-function.js"></script>
+</body>
+</html>
index 130b9da..bf12591 100644 (file)
@@ -1,3 +1,17 @@
+2008-05-07  David Kilzer  <ddkilzer@apple.com>
+
+        Bug 18900: Password field has focus but can't type text (i.rememberthemilk.com)
+        <https://bugs.webkit.org/show_bug.cgi?id=18900>
+
+        Original patch by Aaron Golden and Tim Omernick.  Reviewed by Adele.
+
+        Test: fast/forms/textfield-to-password-on-focus.html
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::setInputType): If the current node has
+        focus, call updateFocusAppearance() to make sure its state is correct
+        after changing its type.
+
 2008-05-07  Chris Fleizach  <cfleizach@apple.com>
 
         Reviewed by Alice Liu
index cc9329e..1f72bdd 100644 (file)
@@ -335,8 +335,11 @@ void HTMLInputElement::setInputType(const String& t)
                     attributeChanged(align, false);
             }
 
-            if (wasAttached)
+            if (wasAttached) {
                 attach();
+                if (document()->focusedNode() == this)
+                    updateFocusAppearance(true);
+            }
 
             checkedRadioButtons(this).addButton(this);
         }