LayoutTests:
authorantti <antti@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Feb 2007 10:52:17 +0000 (10:52 +0000)
committerantti <antti@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Feb 2007 10:52:17 +0000 (10:52 +0000)
        Reviewed by Hyatt.

        - layout test for http://bugs.webkit.org/show_bug.cgi?id=11923
        REGRESSION: Placeholder text in password field shows as bullets
        <rdar://problem/4960257>

        * fast/forms/password-placeholder-expected.checksum: Added.
        * fast/forms/password-placeholder-expected.png: Added.
        * fast/forms/password-placeholder-expected.txt: Added.
        * fast/forms/password-placeholder.html: Added.

WebCore:

        Reviewed by Hyatt.

        - fix http://bugs.webkit.org/show_bug.cgi?id=11923
        REGRESSION: Placeholder text in password field shows as bullets
        <rdar://problem/4960257>

        Disable textSecurity when placeholder is visible.

        * rendering/RenderTextControl.cpp:
        (WebCore::RenderTextControl::updatePlaceholder):

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

LayoutTests/ChangeLog
LayoutTests/fast/forms/password-placeholder-expected.checksum [new file with mode: 0644]
LayoutTests/fast/forms/password-placeholder-expected.png [new file with mode: 0644]
LayoutTests/fast/forms/password-placeholder-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/password-placeholder.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderTextControl.cpp

index 71e46e300998e8b155838adb14c424a9aec2a552..e7946a00d8cbf92496c9af782d684467f729d9e1 100644 (file)
@@ -1,3 +1,16 @@
+2007-02-14  Antti Koivisto  <antti@apple.com>
+
+        Reviewed by Hyatt.
+        
+        - layout test for http://bugs.webkit.org/show_bug.cgi?id=11923
+        REGRESSION: Placeholder text in password field shows as bullets
+        <rdar://problem/4960257>        
+
+        * fast/forms/password-placeholder-expected.checksum: Added.
+        * fast/forms/password-placeholder-expected.png: Added.
+        * fast/forms/password-placeholder-expected.txt: Added.
+        * fast/forms/password-placeholder.html: Added.
+
 2007-02-13  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Mark Rowe.
diff --git a/LayoutTests/fast/forms/password-placeholder-expected.checksum b/LayoutTests/fast/forms/password-placeholder-expected.checksum
new file mode 100644 (file)
index 0000000..e94bb00
--- /dev/null
@@ -0,0 +1 @@
+96559e5e202b3b9774ff1689ceaf726f
\ No newline at end of file
diff --git a/LayoutTests/fast/forms/password-placeholder-expected.png b/LayoutTests/fast/forms/password-placeholder-expected.png
new file mode 100644 (file)
index 0000000..6d905ec
Binary files /dev/null and b/LayoutTests/fast/forms/password-placeholder-expected.png differ
diff --git a/LayoutTests/fast/forms/password-placeholder-expected.txt b/LayoutTests/fast/forms/password-placeholder-expected.txt
new file mode 100644 (file)
index 0000000..b3898a8
--- /dev/null
@@ -0,0 +1,11 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderTextControl {INPUT} at (2,2) size 148x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+      RenderText {#text} at (0,0) size 0x0
+layer at (13,13) size 142x13
+  RenderBlock {DIV} at (3,3) size 142x13 [color=#808080]
+    RenderText {#text} at (1,0) size 36x13
+      text run at (1,0) width 36: "foobar"
diff --git a/LayoutTests/fast/forms/password-placeholder.html b/LayoutTests/fast/forms/password-placeholder.html
new file mode 100644 (file)
index 0000000..48dced7
--- /dev/null
@@ -0,0 +1 @@
+<input type="password" placeholder="foobar">
index d90fd98561858f4aadbc2fecaf5cd3d29deac0e5..23faa123cabccbe3b62c667a37dca64a89f2a772 100644 (file)
@@ -1,3 +1,16 @@
+2007-02-14  Antti Koivisto  <antti@apple.com>
+
+        Reviewed by Hyatt.
+
+        - fix http://bugs.webkit.org/show_bug.cgi?id=11923
+        REGRESSION: Placeholder text in password field shows as bullets
+        <rdar://problem/4960257> 
+        
+        Disable textSecurity when placeholder is visible.
+        
+        * rendering/RenderTextControl.cpp:
+        (WebCore::RenderTextControl::updatePlaceholder):
+
 2007-02-13  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Mark Rowe.
index 3f02e8fc55e6c6e1f69931b09c9fdc1827d2b05d..7be5071f6cab577943c6c754912a32b74cf7d19b 100644 (file)
@@ -217,6 +217,8 @@ RenderStyle* RenderTextControl::createCancelButtonStyle(RenderStyle* startStyle)
 
 void RenderTextControl::updatePlaceholder()
 {
+    bool oldPlaceholderVisible = m_placeholderVisible;
+    
     String placeholder;
     if (!m_multiLine) {
         HTMLInputElement* input = static_cast<HTMLInputElement*>(node());
@@ -239,11 +241,22 @@ void RenderTextControl::updatePlaceholder()
         color = disabledTextColor(style()->color(), style()->backgroundColor());
 
     RenderObject* renderer = m_innerText->renderer();
-    RenderStyle* style = renderer->style();
-    if (style->color() != color) {
-        style->setColor(color);
+    RenderStyle* innerStyle = renderer->style();
+    if (innerStyle->color() != color) {
+        innerStyle->setColor(color);
         renderer->repaint();
     }
+
+    // temporary disable textSecurity if placeholder is visible
+    if (style()->textSecurity() != TSNONE && oldPlaceholderVisible != m_placeholderVisible) {
+        RenderStyle* newInnerStyle = new (renderArena()) RenderStyle(*innerStyle);
+        newInnerStyle->setTextSecurity(m_placeholderVisible ? TSNONE : style()->textSecurity());
+        renderer->setStyle(newInnerStyle);
+        for (Node* n = m_innerText->firstChild(); n; n = n->traverseNextNode(m_innerText.get())) {
+            if (n->renderer())
+                n->renderer()->setStyle(newInnerStyle);
+        }
+    }
 }
 
 void RenderTextControl::createSubtreeIfNeeded()