[prev in list] [next in list] [prev in thread] [next in thread] 

List:       webkit-changes
Subject:    [webkit-changes] [37123] trunk
From:       adele () apple ! com
Date:       2008-09-30 23:21:50
Message-ID: 20080930232151.68D5A449965 () beta ! macosforge ! org
[Download RAW message or body]

[Attachment #2 (text/html)]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[37123] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: \
verdana,arial,helvetica,sans-serif; font-size: 10pt;  } #msg dl a { font-weight: \
bold} #msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: \
bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: \
6px; } #logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em \
0; } #logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg \
h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; } \
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; \
} #logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: \
-1.5em; padding-left: 1.5em; } #logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em \
1em 0 1em; background: white;} #logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid \
#fa0; border-bottom: 1px solid #fa0; background: #fff; } #logmsg table th { \
text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted \
#fa0; } #logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: \
0.2em 0.5em; } #logmsg table thead th { text-align: center; border-bottom: 1px solid \
#fa0; } #logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: \
6px; } #patch { width: 100%; }
#patch h4 {font-family: \
verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
 #patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, \
#patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins \
{background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del \
{background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, \
                .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a \
href="http://trac.webkit.org/projects/webkit/changeset/37123">37123</a></dd> \
<dt>Author</dt> <dd>adele@apple.com</dd> <dt>Date</dt> <dd>2008-09-30 16:21:50 -0700 \
(Tue, 30 Sep 2008)</dd> </dl>

<h3>Log Message</h3>
<pre>WebCore:

2008-09-30  Adele Peterson  &lt;adele@apple.com&gt;

        Reviewed by Darin Adler.

        Fix for https://bugs.webkit.org/show_bug.cgi?id=21227
        &lt;rdar://problem/6222134&gt; add a way to set color for input placeholder \
text

        Test: fast/forms/placeholder-pseudo-style.html

        This change adds &quot;-webkit-input-placeholder-mode&quot; as a pseudo class \
that can be used to style  input elements when they are displaying the placeholder \
text.

        * css/CSSSelector.cpp: (WebCore::CSSSelector::extractPseudoType): Add case \
                for inputPlaceholderMode.
        * css/CSSSelector.h: (WebCore::CSSSelector::): Add \
                PseudoInputPlaceholderMode.
        * css/CSSStyleSelector.cpp: \
                (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector):
        Add check for PseudoInputPlaceholderMode that asks the node if \
                placeholderShouldBeVisible is true.
        * css/html4.css: Add rule to make placeholder text default to darkGray.

        * html/HTMLInputElement.cpp:
        (WebCore::HTMLInputElement::init): Initialize m_placeholderShouldBeVisible.
        (WebCore::HTMLInputElement::dispatchFocusEvent): Call \
updatePlaceholderVisibility.  (WebCore::HTMLInputElement::dispatchBlurEvent): ditto.
        (WebCore::HTMLInputElement::parseMappedAttribute): ditto.
        (WebCore::HTMLInputElement::setValue): ditto.
        (WebCore::HTMLInputElement::setValueFromRenderer): ditto.
        (WebCore::HTMLInputElement::updatePlaceholderVisibility): Sets \
                m_placeholderShouldBeVisible based on the current value and the focus \
                state.
         This calculation used to be done in the renderer, but since the node knows \
                everything about the state, it can make that decision, and the
         renderer will just ask the node if it should draw the placeholder.
        * html/HTMLInputElement.h: \
(WebCore::HTMLInputElement::placeholderShouldBeVisible):

        * rendering/RenderTextControl.cpp:
        (WebCore::disabledTextColor): Moved to the top of the file.  If there's not \
                very much contrast between the disabled color and the background \
                color,
        just leave the text color alone.  We don't want to change a good contrast \
                color scheme so that it has really bad contrast.
        If the the contrast was already poor, then it doesn't do any good to change \
it to a different poor contrast color scheme.  \
(WebCore::RenderTextControl::createInnerTextStyle): If the node says the placeholder \
                should be visible, prepare by overriding the text security to be \
                &quot;none&quot;.
        This can only happen as a result of either a setStyle call (which will be \
                followed by a call to updateFromElement) or from \
                createSubtreeIfNeeded, which
        is called directly from updateFromElement.  updateFromElement will \
                immediately update the text displayed.
        (WebCore::RenderTextControl::updateFromElement): If the placeholder \
                visibility has changed, update the text that is displayed.
        (WebCore::RenderTextControl::forwardEvent): Remove calls to update the \
                placeholder state.  This is now done in HTMLInputElement.
        * rendering/RenderTextControl.h:

LayoutTests:

2008-09-30  Adele Peterson  &lt;adele@apple.com&gt;

        Reviewed by Darin Adler.

        Tests for https://bugs.webkit.org/show_bug.cgi?id=21227
        &lt;rdar://problem/6222134&gt; add a way to set color for input placeholder \
text

        * fast/forms/password-placeholder-text-security.html: Added.
        * fast/forms/placeholder-pseudo-style.html: Added.
        * platform/mac/fast/forms/password-placeholder-text-security-expected.checksum: \
                Added.
        * platform/mac/fast/forms/password-placeholder-text-security-expected.png: \
                Added.
        * platform/mac/fast/forms/password-placeholder-text-security-expected.txt: \
                Added.
        * platform/mac/fast/forms/placeholder-pseudo-style-expected.checksum: Added.
        * platform/mac/fast/forms/placeholder-pseudo-style-expected.png: Added.
        * platform/mac/fast/forms/placeholder-pseudo-style-expected.txt: Added.

        Updated results. The placeholder color is now reflected on the \
RenderTextControl, not just on an inner element.

        * platform/mac/fast/forms/input-disabled-color-expected.checksum:
        * platform/mac/fast/forms/input-disabled-color-expected.png:
        * platform/mac/fast/forms/input-disabled-color-expected.txt:
        * platform/mac/fast/forms/password-placeholder-expected.checksum:
        * platform/mac/fast/forms/password-placeholder-expected.png:
        * platform/mac/fast/forms/password-placeholder-expected.txt:
        * platform/mac/fast/forms/placeholder-set-attribute-expected.checksum:
        * platform/mac/fast/forms/placeholder-set-attribute-expected.png:
        * platform/mac/fast/forms/placeholder-set-attribute-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacfastformsinputdisabledcolorexpectedchecksum"> \
trunk/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.checksum</a></li>
 <li><a href="#trunkLayoutTestsplatformmacfastformsinputdisabledcolorexpectedpng">trunk/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.png</a></li>
 <li><a href="#trunkLayoutTestsplatformmacfastformsinputdisabledcolorexpectedtxt">trunk/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.txt</a></li>
 <li><a href="#trunkLayoutTestsplatformmacfastformspasswordplaceholderexpectedchecksum \
">trunk/LayoutTests/platform/mac/fast/forms/password-placeholder-expected.checksum</a></li>
 <li><a href="#trunkLayoutTestsplatformmacfastformspasswordplaceholderexpectedpng">tru \
nk/LayoutTests/platform/mac/fast/forms/password-placeholder-expected.png</a></li> \
<li><a href="#trunkLayoutTestsplatformmacfastformspasswordplaceholderexpectedtxt">trunk/LayoutTests/platform/mac/fast/forms/password-placeholder-expected.txt</a></li>
 <li><a href="#trunkLayoutTestsplatformmacfastformsplaceholdersetattributeexpectedchec \
ksum">trunk/LayoutTests/platform/mac/fast/forms/placeholder-set-attribute-expected.checksum</a></li>
 <li><a href="#trunkLayoutTestsplatformmacfastformsplaceholdersetattributeexpectedpng" \
>trunk/LayoutTests/platform/mac/fast/forms/placeholder-set-attribute-expected.png</a></li>
> 
<li><a href="#trunkLayoutTestsplatformmacfastformsplaceholdersetattributeexpectedtxt"> \
trunk/LayoutTests/platform/mac/fast/forms/placeholder-set-attribute-expected.txt</a></li>
 <li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCorecssCSSSelectorcpp">trunk/WebCore/css/CSSSelector.cpp</a></li>
 <li><a href="#trunkWebCorecssCSSSelectorh">trunk/WebCore/css/CSSSelector.h</a></li>
<li><a href="#trunkWebCorecssCSSStyleSelectorcpp">trunk/WebCore/css/CSSStyleSelector.cpp</a></li>
 <li><a href="#trunkWebCorecsshtml4css">trunk/WebCore/css/html4.css</a></li>
<li><a href="#trunkWebCorehtmlHTMLInputElementcpp">trunk/WebCore/html/HTMLInputElement.cpp</a></li>
 <li><a href="#trunkWebCorehtmlHTMLInputElementh">trunk/WebCore/html/HTMLInputElement.h</a></li>
 <li><a href="#trunkWebCorerenderingRenderTextControlcpp">trunk/WebCore/rendering/RenderTextControl.cpp</a></li>
 <li><a href="#trunkWebCorerenderingRenderTextControlh">trunk/WebCore/rendering/RenderTextControl.h</a></li>
 </ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastformspasswordplaceholdertextsecurityhtml">trunk/LayoutTests/fast/forms/password-placeholder-text-security.html</a></li>
 <li><a href="#trunkLayoutTestsfastformsplaceholderpseudostylehtml">trunk/LayoutTests/fast/forms/placeholder-pseudo-style.html</a></li>
 <li><a href="#trunkLayoutTestsplatformmacfastformspasswordplaceholdertextsecurityexpe \
ctedchecksum">trunk/LayoutTests/platform/mac/fast/forms/password-placeholder-text-security-expected.checksum</a></li>
 <li><a href="#trunkLayoutTestsplatformmacfastformspasswordplaceholdertextsecurityexpe \
ctedpng">trunk/LayoutTests/platform/mac/fast/forms/password-placeholder-text-security-expected.png</a></li>
 <li><a href="#trunkLayoutTestsplatformmacfastformspasswordplaceholdertextsecurityexpe \
ctedtxt">trunk/LayoutTests/platform/mac/fast/forms/password-placeholder-text-security-expected.txt</a></li>
 <li><a href="#trunkLayoutTestsplatformmacfastformsplaceholderpseudostyleexpectedcheck \
sum">trunk/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.checksum</a></li>
 <li><a href="#trunkLayoutTestsplatformmacfastformsplaceholderpseudostyleexpectedpng"> \
trunk/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.png</a></li>
 <li><a href="#trunkLayoutTestsplatformmacfastformsplaceholderpseudostyleexpectedtxt"> \
trunk/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.txt</a></li>
 </ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (37122 => 37123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog	2008-09-30 23:19:53 UTC (rev \
                37122)
+++ trunk/LayoutTests/ChangeLog	2008-09-30 23:21:50 UTC (rev 37123)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2008-09-30  Adele Peterson  &lt;adele@apple.com&gt;
+
+        Reviewed by Darin Adler.
+
+        Tests for https://bugs.webkit.org/show_bug.cgi?id=21227
+        &lt;rdar://problem/6222134&gt; add a way to set color for input placeholder \
text +
+        * fast/forms/password-placeholder-text-security.html: Added.
+        * fast/forms/placeholder-pseudo-style.html: Added.
+        * platform/mac/fast/forms/password-placeholder-text-security-expected.checksum: \
Added. +        * platform/mac/fast/forms/password-placeholder-text-security-expected.png: \
Added. +        * platform/mac/fast/forms/password-placeholder-text-security-expected.txt: \
Added. +        * platform/mac/fast/forms/placeholder-pseudo-style-expected.checksum: \
Added. +        * platform/mac/fast/forms/placeholder-pseudo-style-expected.png: \
Added. +        * platform/mac/fast/forms/placeholder-pseudo-style-expected.txt: \
Added. +
+        Updated results. The placeholder color is now reflected on the \
RenderTextControl, not just on an inner element. +
+        * platform/mac/fast/forms/input-disabled-color-expected.checksum:
+        * platform/mac/fast/forms/input-disabled-color-expected.png:
+        * platform/mac/fast/forms/input-disabled-color-expected.txt:
+        * platform/mac/fast/forms/password-placeholder-expected.checksum:
+        * platform/mac/fast/forms/password-placeholder-expected.png:
+        * platform/mac/fast/forms/password-placeholder-expected.txt:
+        * platform/mac/fast/forms/placeholder-set-attribute-expected.checksum:
+        * platform/mac/fast/forms/placeholder-set-attribute-expected.png:
+        * platform/mac/fast/forms/placeholder-set-attribute-expected.txt:
+
</ins><span class="cx"> 2008-09-30  Beth Dakin  &lt;bdakin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Darin Adler.
</span></span></pre></div>
<a id="trunkLayoutTestsfastformspasswordplaceholdertextsecurityhtml"></a>
<div class="addfile"><h4>Added: \
trunk/LayoutTests/fast/forms/password-placeholder-text-security.html (0 => \
37123)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/LayoutTests/fast/forms/password-placeholder-text-security.html	                 \
                (rev 0)
+++ trunk/LayoutTests/fast/forms/password-placeholder-text-security.html	2008-09-30 \
23:21:50 UTC (rev 37123) </span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+&lt;html&gt;
+    &lt;head&gt;
+        &lt;script&gt;
+            function test()
+            {
+                if (window.layoutTestController)
+                    layoutTestController.waitUntilDone();
+                    
+                // 1) leave field 1 alone. It should show the placeholder text.
+                // 2) focus field 2 and type.  It should show bullets for the \
password. +                    var password = \
document.getElementById(&quot;pass2&quot;); +                    password.focus();
+                    document.execCommand(&quot;InsertText&quot;, false, \
&quot;test&quot;); +                // 3) focus field 3 and type.  Clear the value \
and blur the field.  It should show the placeholder text. +                    \
password = document.getElementById(&quot;pass3&quot;); +                    \
password.focus(); +                    document.execCommand(&quot;InsertText&quot;, \
false, &quot;test&quot;); +                    password.value = &quot;&quot;;
+                    password.blur();
+
+                if (window.layoutTestController)
+                    layoutTestController.notifyDone();
+            }
+            function log(msg)
+            {
+                document.getElementById('console').appendChild(document.createTextNode(msg \
+ &quot;\n&quot;)); +            }
+        &lt;/script&gt;
+    &lt;/head&gt;
+    &lt;body onload=&quot;test()&quot;&gt;
+        This tests that the text security mode switches correctly when the \
placeholder appears and disappears.&lt;br&gt; +        Leave field 1 alone. It should \
show the placeholder text: &lt;input type=&quot;password&quot; id=&quot;pass1&quot; \
placeholder=&quot;placeholder&quot;&gt;&lt;br&gt; +        Focus field 2 and type.  \
It should show bullets for the password.: &lt;input type=&quot;password&quot; \
id=&quot;pass2&quot; placeholder=&quot;placeholder&quot;&gt;&lt;br&gt; +        Focus \
field 3 and type.  Clear the value and blur the field.  It should show the \
placeholder text: &lt;input type=&quot;password&quot; id=&quot;pass3&quot; \
placeholder=&quot;placeholder&quot;&gt;&lt;br&gt; +    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsplaceholderpseudostylehtml"></a>
<div class="addfile"><h4>Added: \
trunk/LayoutTests/fast/forms/placeholder-pseudo-style.html (0 => 37123)</h4> <pre \
class="diff"><span> <span class="info">--- \
trunk/LayoutTests/fast/forms/placeholder-pseudo-style.html	                        \
                (rev 0)
+++ trunk/LayoutTests/fast/forms/placeholder-pseudo-style.html	2008-09-30 23:21:50 \
UTC (rev 37123) </span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+&lt;style&gt;
+input.red:-webkit-input-placeholder-mode {
+    color: rgb(100, 0, 0);
+}
+&lt;/style&gt;
+This tests that you can set the placeholder text color.&lt;br&gt;
+&lt;input class=&quot;red&quot; placeholder=&quot;text&quot;&gt;
+&lt;input class=&quot;red&quot; type=&quot;search&quot; \
placeholder=&quot;search&quot;&gt; +&lt;input class=&quot;red&quot; \
type=&quot;password&quot; placeholder=&quot;password&quot;&gt; +&lt;input \
class=&quot;red&quot; disabled placeholder=&quot;disabled text&quot;&gt; +&lt;input \
placeholder=&quot;default&quot;&gt; +&lt;input placeholder=&quot;default \
disabled&quot;&gt; </ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastformsinputdisabledcolorexpectedchecksum"></a>
<div class="modfile"><h4>Modified: \
trunk/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.checksum \
(37122 => 37123)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.checksum	2008-09-30 \
                23:19:53 UTC (rev 37122)
+++ trunk/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.checksum	2008-09-30 \
23:21:50 UTC (rev 37123) </span><span class="lines">@@ -1 +1 @@
</span><del>-a6f4c1280e857f210a29112c8b670771
</del><span class="cx">\ No newline at end of file
</span><ins>+c54c765ce3626d34ea5606ed65cd03cd
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastformsinputdisabledcolorexpectedpng"></a>
<div class="binary"><h4>Modified: \
trunk/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.png</h4> <pre \
class="diff"><span> <span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastformsinputdisabledcolorexpectedtxt"></a>
<div class="modfile"><h4>Modified: \
trunk/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.txt (37122 => \
37123)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.txt	2008-09-30 \
                23:19:53 UTC (rev 37122)
+++ trunk/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.txt	2008-09-30 \
23:21:50 UTC (rev 37123) </span><span class="lines">@@ -118,7 +118,7 @@
</span><span class="cx">     RenderText {#text} at (1,0) size 156x13
</span><span class="cx">       text run at (1,0) width 156: &quot;This text field is \
not disabled&quot; </span><span class="cx"> layer at (13,192) size 142x13 scrollWidth \
356 </span><del>-  RenderBlock {DIV} at (3,3) size 142x13 [color=#ABABAB]
</del><ins>+  RenderBlock {DIV} at (3,3) size 142x13
</ins><span class="cx">     RenderText {#text} at (1,0) size 355x13
</span><span class="cx">       text run at (1,0) width 355: &quot;The text in this \
disabled field should displayed as dimmed or grey&quot; </span><span class="cx"> \
layer at (169,192) size 142x13 scrollWidth 158 </span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastformspasswordplaceholderexpectedchecksum"></a>
<div class="modfile"><h4>Modified: \
trunk/LayoutTests/platform/mac/fast/forms/password-placeholder-expected.checksum \
(37122 => 37123)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/LayoutTests/platform/mac/fast/forms/password-placeholder-expected.checksum	2008-09-30 \
                23:19:53 UTC (rev 37122)
+++ trunk/LayoutTests/platform/mac/fast/forms/password-placeholder-expected.checksum	2008-09-30 \
23:21:50 UTC (rev 37123) </span><span class="lines">@@ -1 +1 @@
</span><del>-96559e5e202b3b9774ff1689ceaf726f
</del><span class="cx">\ No newline at end of file
</span><ins>+5cf4696ebda55d530e503126cadf3b97
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastformspasswordplaceholderexpectedpng"></a>
<div class="binary"><h4>Modified: \
trunk/LayoutTests/platform/mac/fast/forms/password-placeholder-expected.png</h4> <pre \
class="diff"><span> <span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastformspasswordplaceholderexpectedtxt"></a>
<div class="modfile"><h4>Modified: \
trunk/LayoutTests/platform/mac/fast/forms/password-placeholder-expected.txt (37122 => \
37123)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/LayoutTests/platform/mac/fast/forms/password-placeholder-expected.txt	2008-09-30 \
                23:19:53 UTC (rev 37122)
+++ trunk/LayoutTests/platform/mac/fast/forms/password-placeholder-expected.txt	2008-09-30 \
23:21:50 UTC (rev 37123) </span><span class="lines">@@ -3,9 +3,9 @@
</span><span class="cx"> layer at (0,0) size 800x600
</span><span class="cx">   RenderBlock {HTML} at (0,0) size 800x600
</span><span class="cx">     RenderBody {BODY} at (8,8) size 784x584
</span><del>-      RenderTextControl {INPUT} at (2,2) size 148x19 [bgcolor=#FFFFFF] \
[border: (2px inset #000000)] </del><ins>+      RenderTextControl {INPUT} at (2,2) \
size 148x19 [color=#A9A9A9] [bgcolor=#FFFFFF] [border: (2px inset #A9A9A9)] \
</ins><span class="cx">       RenderText {#text} at (0,0) size 0x0 </span><span \
class="cx"> layer at (13,13) size 142x13 </span><del>-  RenderBlock {DIV} at (3,3) \
size 142x13 [color=#808080] </del><ins>+  RenderBlock {DIV} at (3,3) size 142x13
</ins><span class="cx">     RenderText {#text} at (1,0) size 36x13
</span><span class="cx">       text run at (1,0) width 36: &quot;foobar&quot;
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastformspasswordplaceholdertextsecurityexpectedchecksum"></a>
 <div class="addfile"><h4>Added: \
trunk/LayoutTests/platform/mac/fast/forms/password-placeholder-text-security-expected.checksum \
(0 => 37123)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/LayoutTests/platform/mac/fast/forms/password-placeholder-text-security-expected.checksum	 \
                (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/forms/password-placeholder-text-security-expected.checksum	2008-09-30 \
23:21:50 UTC (rev 37123) </span><span class="lines">@@ -0,0 +1 @@
</span><ins>+9dc90e9f4705b34ae7f4fdc81fa5fbea
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastformspasswordplaceholdertextsecurityexpectedpng"></a>
 <div class="binary"><h4>Added: \
trunk/LayoutTests/platform/mac/fast/forms/password-placeholder-text-security-expected.png</h4>
 <pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: \
trunk/LayoutTests/platform/mac/fast/forms/password-placeholder-text-security-expected.png
 </span><span class="cx">___________________________________________________________________
 </span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsplatformmacfastformspasswordplaceholdertextsecurityexpectedtxt"></a>
 <div class="addfile"><h4>Added: \
trunk/LayoutTests/platform/mac/fast/forms/password-placeholder-text-security-expected.txt \
(0 => 37123)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/LayoutTests/platform/mac/fast/forms/password-placeholder-text-security-expected.txt	 \
                (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/forms/password-placeholder-text-security-expected.txt	2008-09-30 \
23:21:50 UTC (rev 37123) </span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+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
+      RenderText {#text} at (0,0) size 637x18
+        text run at (0,0) width 637: &quot;This tests that the text security mode \
switches correctly when the placeholder appears and disappears.&quot; +      RenderBR \
{BR} at (637,14) size 0x0 +      RenderText {#text} at (0,20) size 357x18
+        text run at (0,20) width 357: &quot;Leave field 1 alone. It should show the \
placeholder text: &quot; +      RenderTextControl {INPUT} at (359,20) size 148x19 \
[color=#A9A9A9] [bgcolor=#FFFFFF] [border: (2px inset #A9A9A9)] +      RenderBR {BR} \
at (509,34) size 0x0 +      RenderText {#text} at (0,43) size 407x18
+        text run at (0,43) width 148: &quot;Focus field 2 and type. &quot;
+        text run at (148,43) width 259: &quot;It should show bullets for the \
password.: &quot; +      RenderTextControl {INPUT} at (409,43) size 148x19 \
[bgcolor=#FFFFFF] [border: (2px inset #000000)] +      RenderBR {BR} at (559,57) size \
0x0 +      RenderText {#text} at (0,66) size 590x18
+        text run at (0,66) width 148: &quot;Focus field 3 and type. &quot;
+        text run at (148,66) width 214: &quot;Clear the value and blur the field. \
&quot; +        text run at (362,66) width 228: &quot;It should show the placeholder \
text: &quot; +      RenderTextControl {INPUT} at (592,66) size 148x19 [color=#A9A9A9] \
[bgcolor=#FFFFFF] [border: (2px inset #A9A9A9)] +      RenderBR {BR} at (742,80) size \
0x0 +layer at (370,31) size 142x13
+  RenderBlock {DIV} at (3,3) size 142x13
+    RenderText {#text} at (1,0) size 63x13
+      text run at (1,0) width 63: &quot;placeholder&quot;
+layer at (420,54) size 142x13
+  RenderBlock {DIV} at (3,3) size 142x13
+    RenderText {#text} at (1,0) size 25x13
+      text run at (1,0) width 25: &quot;\x{2022}\x{2022}\x{2022}\x{2022}&quot;
+layer at (603,77) size 142x13
+  RenderBlock {DIV} at (3,3) size 142x13
+    RenderText {#text} at (1,0) size 63x13
+      text run at (1,0) width 63: &quot;placeholder&quot;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastformsplaceholderpseudostyleexpectedchecksum"></a>
 <div class="addfile"><h4>Added: \
trunk/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.checksum \
(0 => 37123)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.checksum	 \
                (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.checksum	2008-09-30 \
23:21:50 UTC (rev 37123) </span><span class="lines">@@ -0,0 +1 @@
</span><ins>+324a8f21eae92afe4daf905543428687
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastformsplaceholderpseudostyleexpectedpng"></a>
<div class="binary"><h4>Added: \
trunk/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.png</h4> \
<pre class="diff"><span> <span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: \
trunk/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.png \
</span><span class="cx">___________________________________________________________________
 </span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestsplatformmacfastformsplaceholderpseudostyleexpectedtxt"></a>
<div class="addfile"><h4>Added: \
trunk/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.txt (0 => \
37123)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.txt	      \
                (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.txt	2008-09-30 \
23:21:50 UTC (rev 37123) </span><span class="lines">@@ -0,0 +1,52 @@
</span><ins>+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
+      RenderText {#text} at (0,0) size 328x18
+        text run at (0,0) width 328: &quot;This tests that you can set the \
placeholder text color.&quot; +      RenderBR {BR} at (328,14) size 0x0
+      RenderTextControl {INPUT} at (2,20) size 148x19 [color=#640000] \
[bgcolor=#FFFFFF] [border: (2px inset #640000)] +      RenderText {#text} at (152,20) \
size 4x18 +        text run at (152,20) width 4: &quot; &quot;
+      RenderTextControl {INPUT} at (158,20) size 148x19 [color=#640000] \
[bgcolor=#FFFFFF] [border: (2px inset #640000)] +        RenderBlock {DIV} at (3,3) \
size 142x13 +          RenderBlock {DIV} at (0,0) size 8x11
+          RenderBlock {DIV} at (129,0) size 13x11
+      RenderText {#text} at (308,20) size 4x18
+        text run at (308,20) width 4: &quot; &quot;
+      RenderTextControl {INPUT} at (314,20) size 148x19 [color=#640000] \
[bgcolor=#FFFFFF] [border: (2px inset #640000)] +      RenderText {#text} at (464,20) \
size 4x18 +        text run at (464,20) width 4: &quot; &quot;
+      RenderTextControl {INPUT} at (470,20) size 148x19 [color=#640000] \
[bgcolor=#FFFFFF] [border: (2px inset #640000)] +      RenderText {#text} at (620,20) \
size 4x18 +        text run at (620,20) width 4: &quot; &quot;
+      RenderTextControl {INPUT} at (626,20) size 148x19 [color=#A9A9A9] \
[bgcolor=#FFFFFF] [border: (2px inset #A9A9A9)] +      RenderText {#text} at (776,20) \
size 4x18 +        text run at (776,20) width 4: &quot; &quot;
+      RenderTextControl {INPUT} at (2,43) size 148x19 [color=#A9A9A9] \
[bgcolor=#FFFFFF] [border: (2px inset #A9A9A9)] +      RenderText {#text} at (0,0) \
size 0x0 +layer at (13,31) size 142x13
+  RenderBlock {DIV} at (3,3) size 142x13
+    RenderText {#text} at (1,0) size 22x13
+      text run at (1,0) width 22: &quot;text&quot;
+layer at (177,31) size 121x13
+  RenderBlock {DIV} at (8,0) size 121x13
+    RenderText {#text} at (1,0) size 35x13
+      text run at (1,0) width 35: &quot;search&quot;
+layer at (325,31) size 142x13
+  RenderBlock {DIV} at (3,3) size 142x13
+    RenderText {#text} at (1,0) size 51x13
+      text run at (1,0) width 51: &quot;password&quot;
+layer at (481,31) size 142x13
+  RenderBlock {DIV} at (3,3) size 142x13 [color=#B80000]
+    RenderText {#text} at (1,0) size 70x13
+      text run at (1,0) width 70: &quot;disabled text&quot;
+layer at (637,31) size 142x13
+  RenderBlock {DIV} at (3,3) size 142x13
+    RenderText {#text} at (1,0) size 38x13
+      text run at (1,0) width 38: &quot;default&quot;
+layer at (13,54) size 142x13
+  RenderBlock {DIV} at (3,3) size 142x13
+    RenderText {#text} at (1,0) size 86x13
+      text run at (1,0) width 86: &quot;default disabled&quot;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastformsplaceholdersetattributeexpectedchecksum"></a>
 <div class="modfile"><h4>Modified: \
trunk/LayoutTests/platform/mac/fast/forms/placeholder-set-attribute-expected.checksum \
(37122 => 37123)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/LayoutTests/platform/mac/fast/forms/placeholder-set-attribute-expected.checksum	2008-09-30 \
                23:19:53 UTC (rev 37122)
+++ trunk/LayoutTests/platform/mac/fast/forms/placeholder-set-attribute-expected.checksum	2008-09-30 \
23:21:50 UTC (rev 37123) </span><span class="lines">@@ -1 +1 @@
</span><del>-6d1463e5373bdf10e7df94df12a7da83
</del><span class="cx">\ No newline at end of file
</span><ins>+d6a054a092f3df8e121346759452e52b
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastformsplaceholdersetattributeexpectedpng"></a>
<div class="binary"><h4>Modified: \
trunk/LayoutTests/platform/mac/fast/forms/placeholder-set-attribute-expected.png</h4> \
<pre class="diff"><span> <span class="cx">(Binary files differ)
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfastformsplaceholdersetattributeexpectedtxt"></a>
<div class="modfile"><h4>Modified: \
trunk/LayoutTests/platform/mac/fast/forms/placeholder-set-attribute-expected.txt \
(37122 => 37123)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/LayoutTests/platform/mac/fast/forms/placeholder-set-attribute-expected.txt	2008-09-30 \
                23:19:53 UTC (rev 37122)
+++ trunk/LayoutTests/platform/mac/fast/forms/placeholder-set-attribute-expected.txt	2008-09-30 \
23:21:50 UTC (rev 37123) </span><span class="lines">@@ -7,8 +7,8 @@
</span><span class="cx">         RenderText {#text} at (0,0) size 441x18
</span><span class="cx">           text run at (0,0) width 441: &quot;If you can see \
the word \&quot;Placeholder\&quot; in the text field, then all is well.&quot; \
</span><span class="cx">       RenderBlock {P} at (0,34) size 784x23 </span><del>-    \
RenderTextControl {INPUT} at (2,2) size 148x19 [bgcolor=#FFFFFF] [border: (2px inset \
#000000)] </del><ins>+        RenderTextControl {INPUT} at (2,2) size 148x19 \
[color=#A9A9A9] [bgcolor=#FFFFFF] [border: (2px inset #A9A9A9)] </ins><span \
class="cx"> layer at (13,47) size 142x13 </span><del>-  RenderBlock {DIV} at (3,3) \
size 142x13 [color=#808080] </del><ins>+  RenderBlock {DIV} at (3,3) size 142x13
</ins><span class="cx">     RenderText {#text} at (1,0) size 62x13
</span><span class="cx">       text run at (1,0) width 62: &quot;Placeholder&quot;
</span></span></pre></div>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (37122 => 37123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog	2008-09-30 23:19:53 UTC (rev 37122)
+++ trunk/WebCore/ChangeLog	2008-09-30 23:21:50 UTC (rev 37123)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2008-09-30  Adele Peterson  &lt;adele@apple.com&gt;
+
+        Reviewed by Darin Adler.
+
+        Fix for https://bugs.webkit.org/show_bug.cgi?id=21227
+        &lt;rdar://problem/6222134&gt; add a way to set color for input placeholder \
text +
+        Test: fast/forms/placeholder-pseudo-style.html
+
+        This change adds &quot;-webkit-input-placeholder-mode&quot; as a pseudo \
class that can be used to style +        input elements when they are displaying the \
placeholder text. +
+        * css/CSSSelector.cpp: (WebCore::CSSSelector::extractPseudoType): Add case \
for inputPlaceholderMode. +        * css/CSSSelector.h: (WebCore::CSSSelector::): Add \
PseudoInputPlaceholderMode. +        * css/CSSStyleSelector.cpp: \
(WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): +        Add check \
for PseudoInputPlaceholderMode that asks the node if placeholderShouldBeVisible is \
true. +        * css/html4.css: Add rule to make placeholder text default to \
darkGray. +
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::init): Initialize m_placeholderShouldBeVisible.
+        (WebCore::HTMLInputElement::dispatchFocusEvent): Call \
updatePlaceholderVisibility. +        (WebCore::HTMLInputElement::dispatchBlurEvent): \
ditto. +        (WebCore::HTMLInputElement::parseMappedAttribute): ditto.
+        (WebCore::HTMLInputElement::setValue): ditto.
+        (WebCore::HTMLInputElement::setValueFromRenderer): ditto.
+        (WebCore::HTMLInputElement::updatePlaceholderVisibility): Sets \
m_placeholderShouldBeVisible based on the current value and the focus state. +        \
This calculation used to be done in the renderer, but since the node knows everything \
about the state, it can make that decision, and the +         renderer will just ask \
the node if it should draw the placeholder. +        * html/HTMLInputElement.h: \
(WebCore::HTMLInputElement::placeholderShouldBeVisible): +
+        * rendering/RenderTextControl.cpp:
+        (WebCore::disabledTextColor): Moved to the top of the file.  If there's not \
very much contrast between the disabled color and the background color, +        just \
leave the text color alone.  We don't want to change a good contrast color scheme so \
that it has really bad contrast. +        If the the contrast was already poor, then \
it doesn't do any good to change it to a different poor contrast color scheme. +      \
(WebCore::RenderTextControl::createInnerTextStyle): If the node says the placeholder \
should be visible, prepare by overriding the text security to be &quot;none&quot;. +  \
This can only happen as a result of either a setStyle call (which will be followed by \
a call to updateFromElement) or from createSubtreeIfNeeded, which +        is called \
directly from updateFromElement.  updateFromElement will immediately update the text \
displayed. +        (WebCore::RenderTextControl::updateFromElement): If the \
placeholder visibility has changed, update the text that is displayed. +        \
(WebCore::RenderTextControl::forwardEvent): Remove calls to update the placeholder \
state.  This is now done in HTMLInputElement. +        * \
rendering/RenderTextControl.h: +
</ins><span class="cx"> 2008-09-30  Beth Dakin  &lt;bdakin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Darin Adler.
</span></span></pre></div>
<a id="trunkWebCorecssCSSSelectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/css/CSSSelector.cpp (37122 => \
37123)</h4> <pre class="diff"><span>
<span class="info">--- trunk/WebCore/css/CSSSelector.cpp	2008-09-30 23:19:53 UTC (rev \
                37122)
+++ trunk/WebCore/css/CSSSelector.cpp	2008-09-30 23:21:50 UTC (rev 37123)
</span><span class="lines">@@ -88,6 +88,7 @@
</span><span class="cx">     static AtomicString focus(&quot;focus&quot;);
</span><span class="cx">     static AtomicString hover(&quot;hover&quot;);
</span><span class="cx">     static AtomicString \
indeterminate(&quot;indeterminate&quot;); </span><ins>+    static AtomicString \
inputPlaceholderMode(&quot;-webkit-input-placeholder-mode&quot;); </ins><span \
class="cx">     static AtomicString lastChild(&quot;last-child&quot;); </span><span \
class="cx">     static AtomicString lastOfType(&quot;last-of-type&quot;); \
</span><span class="cx">     static AtomicString link(&quot;link&quot;); </span><span \
class="lines">@@ -152,6 +153,8 @@ </span><span class="cx">         m_pseudoType = \
PseudoFirstChild; </span><span class="cx">     else if (m_value == fullPageMedia)
</span><span class="cx">         m_pseudoType = PseudoFullPageMedia;
</span><ins>+    else if (m_value == inputPlaceholderMode)
+        m_pseudoType = PseudoInputPlaceholderMode;
</ins><span class="cx">     else if (m_value == lastChild)
</span><span class="cx">         m_pseudoType = PseudoLastChild;
</span><span class="cx">     else if (m_value == lastOfType)
</span></span></pre></div>
<a id="trunkWebCorecssCSSSelectorh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/css/CSSSelector.h (37122 => \
37123)</h4> <pre class="diff"><span>
<span class="info">--- trunk/WebCore/css/CSSSelector.h	2008-09-30 23:19:53 UTC (rev \
                37122)
+++ trunk/WebCore/css/CSSSelector.h	2008-09-30 23:21:50 UTC (rev 37123)
</span><span class="lines">@@ -140,6 +140,7 @@
</span><span class="cx">             PseudoEnabled,
</span><span class="cx">             PseudoFullPageMedia,
</span><span class="cx">             PseudoDisabled,
</span><ins>+            PseudoInputPlaceholderMode,
</ins><span class="cx">             PseudoReadOnly,
</span><span class="cx">             PseudoReadWrite,
</span><span class="cx">             PseudoIndeterminate,
</span></span></pre></div>
<a id="trunkWebCorecssCSSStyleSelectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/css/CSSStyleSelector.cpp (37122 => \
37123)</h4> <pre class="diff"><span>
<span class="info">--- trunk/WebCore/css/CSSStyleSelector.cpp	2008-09-30 23:19:53 UTC \
                (rev 37122)
+++ trunk/WebCore/css/CSSStyleSelector.cpp	2008-09-30 23:21:50 UTC (rev 37123)
</span><span class="lines">@@ -2191,6 +2191,10 @@
</span><span class="cx">                     // that are non-&quot;hidden&quot; \
controls. </span><span class="cx">                     return !e-&gt;isEnabled();     \
 </span><span class="cx">                 break;
</span><ins>+            case CSSSelector::PseudoInputPlaceholderMode:
+                if (e &amp;&amp; e-&gt;hasTagName(inputTag))
+                    return \
static_cast&lt;HTMLInputElement*&gt;(e)-&gt;placeholderShouldBeVisible(); +           \
break; </ins><span class="cx">             case CSSSelector::PseudoReadOnly:
</span><span class="cx">                 return e &amp;&amp; e-&gt;isTextControl() \
&amp;&amp; e-&gt;isReadOnlyControl(); </span><span class="cx">             case \
CSSSelector::PseudoReadWrite: </span></span></pre></div>
<a id="trunkWebCorecsshtml4css"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/css/html4.css (37122 => 37123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/css/html4.css	2008-09-30 23:19:53 UTC (rev \
                37122)
+++ trunk/WebCore/css/html4.css	2008-09-30 23:21:50 UTC (rev 37123)
</span><span class="lines">@@ -361,6 +361,10 @@
</span><span class="cx">     cursor: auto;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+input:-webkit-input-placeholder-mode {
+    color: darkGray;
+}
+
</ins><span class="cx"> input[type=&quot;password&quot;] {
</span><span class="cx">     -webkit-text-security: disc !important;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLInputElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLInputElement.cpp (37122 => \
37123)</h4> <pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLInputElement.cpp	2008-09-30 23:19:53 \
                UTC (rev 37122)
+++ trunk/WebCore/html/HTMLInputElement.cpp	2008-09-30 23:21:50 UTC (rev 37123)
</span><span class="lines">@@ -127,7 +127,8 @@
</span><span class="cx">     m_autocomplete = Uninitialized;
</span><span class="cx">     m_inited = false;
</span><span class="cx">     m_autofilled = false;
</span><del>-
</del><ins>+    m_placeholderShouldBeVisible = false;
+    
</ins><span class="cx">     xPos = 0;
</span><span class="cx">     yPos = 0;
</span><span class="cx">     
</span><span class="lines">@@ -245,6 +246,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (isTextField()) {
</span><span class="cx">         setAutofilled(false);
</span><ins>+        updatePlaceholderVisibility();
</ins><span class="cx">         if (inputType() == PASSWORD &amp;&amp; \
document()-&gt;frame()) </span><span class="cx">             \
document()-&gt;setUseSecureKeyboardEntryWhenActive(true); </span><span class="cx">    \
} </span><span class="lines">@@ -254,6 +256,7 @@
</span><span class="cx"> void HTMLInputElement::dispatchBlurEvent()
</span><span class="cx"> {
</span><span class="cx">     if (isTextField() &amp;&amp; document()-&gt;frame()) {
</span><ins>+        updatePlaceholderVisibility();
</ins><span class="cx">         if (inputType() == PASSWORD)
</span><span class="cx">             \
document()-&gt;setUseSecureKeyboardEntryWhenActive(false); </span><span class="cx">   \
document()-&gt;frame()-&gt;textFieldDidEndEditing(this); </span><span \
class="lines">@@ -689,9 +692,10 @@ </span><span class="cx">             attach();
</span><span class="cx">         }
</span><span class="cx">         setChanged();
</span><del>-    } else if (attr-&gt;name() == autosaveAttr ||
</del><ins>+    } else if (attr-&gt;name() == placeholderAttr)
+        updatePlaceholderVisibility();
+    else if (attr-&gt;name() == autosaveAttr ||
</ins><span class="cx">                attr-&gt;name() == incrementalAttr ||
</span><del>-               attr-&gt;name() == placeholderAttr ||
</del><span class="cx">                attr-&gt;name() == minAttr ||
</span><span class="cx">                attr-&gt;name() == maxAttr ||
</span><span class="cx">                attr-&gt;name() == precisionAttr) {
</span><span class="lines">@@ -995,6 +999,8 @@
</span><span class="cx">     if (inputType() == FILE &amp;&amp; !value.isEmpty())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    updatePlaceholderVisibility();
+    
</ins><span class="cx">     setValueMatchesRenderer(false);
</span><span class="cx">     if (storesValueSeparateFromAttribute()) {
</span><span class="cx">         if (inputType() == FILE)
</span><span class="lines">@@ -1026,6 +1032,8 @@
</span><span class="cx">     // Renderer and our event handler are responsible for \
constraining values. </span><span class="cx">     ASSERT(value == \
constrainValue(value) || constrainValue(value).isEmpty()); </span><span class="cx"> 
</span><ins>+    updatePlaceholderVisibility();
+    
</ins><span class="cx">     if (inputType() == FILE) {
</span><span class="cx">         m_fileList-&gt;clear();
</span><span class="cx">         m_fileList-&gt;append(File::create(value));
</span><span class="lines">@@ -1550,6 +1558,18 @@
</span><span class="cx">         \
document()-&gt;unregisterForDocumentActivationCallbacks(this); </span><span \
class="cx"> } </span><span class="cx"> 
</span><ins>+void HTMLInputElement::updatePlaceholderVisibility()
+{
+    bool oldPlaceholderShouldBeVisible = m_placeholderShouldBeVisible;
+    
+    m_placeholderShouldBeVisible = value().isEmpty() 
+        &amp;&amp; document()-&gt;focusedNode() != this
+        &amp;&amp; !getAttribute(placeholderAttr).isEmpty();
+
+    if (oldPlaceholderShouldBeVisible != m_placeholderShouldBeVisible)
+        setChanged();
+}
+
</ins><span class="cx"> String HTMLInputElement::constrainValue(const String&amp; \
proposedValue, int maxLen) const </span><span class="cx"> {
</span><span class="cx">     if (isTextField()) {
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLInputElementh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLInputElement.h (37122 => \
37123)</h4> <pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLInputElement.h	2008-09-30 23:19:53 UTC \
                (rev 37122)
+++ trunk/WebCore/html/HTMLInputElement.h	2008-09-30 23:21:50 UTC (rev 37123)
</span><span class="lines">@@ -204,6 +204,8 @@
</span><span class="cx">     
</span><span class="cx">     virtual bool willValidate() const;
</span><span class="cx"> 
</span><ins>+    bool placeholderShouldBeVisible() const { return \
m_placeholderShouldBeVisible; } +    
</ins><span class="cx"> protected:
</span><span class="cx">     virtual void willMoveToNewOwnerDocument();
</span><span class="cx">     virtual void didMoveToNewOwnerDocument();
</span><span class="lines">@@ -220,6 +222,8 @@
</span><span class="cx">     void registerForActivationCallbackIfNeeded();
</span><span class="cx">     void unregisterForActivationCallbackIfNeeded();
</span><span class="cx"> 
</span><ins>+    void updatePlaceholderVisibility();
+    
</ins><span class="cx">     String m_value;
</span><span class="cx">     String m_originalValue;
</span><span class="cx">     int xPos;
</span><span class="lines">@@ -243,6 +247,7 @@
</span><span class="cx">     AutoCompleteSetting m_autocomplete : 2;
</span><span class="cx">     bool m_autofilled : 1;
</span><span class="cx">     bool m_inited : 1;
</span><ins>+    bool m_placeholderShouldBeVisible : 1;
</ins><span class="cx">     
</span><span class="cx">     int cachedSelStart;
</span><span class="cx">     int cachedSelEnd;
</span></span></pre></div>
<a id="trunkWebCorerenderingRenderTextControlcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/rendering/RenderTextControl.cpp \
(37122 => 37123)</h4> <pre class="diff"><span>
<span class="info">--- trunk/WebCore/rendering/RenderTextControl.cpp	2008-09-30 \
                23:19:53 UTC (rev 37122)
+++ trunk/WebCore/rendering/RenderTextControl.cpp	2008-09-30 23:21:50 UTC (rev 37123)
</span><span class="lines">@@ -58,6 +58,28 @@
</span><span class="cx"> using namespace EventNames;
</span><span class="cx"> using namespace HTMLNames;
</span><span class="cx"> 
</span><ins>+// Value chosen by observation.  This can be tweaked.
+static const int minColorContrastValue = 1300;
+
+static Color disabledTextColor(const Color&amp; textColor, const Color&amp; \
backgroundColor) +{
+    // The explicit check for black is an optimization for the 99% case (black on \
white). +    // This also means that black on black will turn into grey on black when \
disabled. +    Color disabledColor;
+    if (textColor.rgb() == Color::black || differenceSquared(textColor, \
Color::white) &gt; differenceSquared(backgroundColor, Color::white)) +        \
disabledColor = textColor.light(); +    else
+        disabledColor = textColor.dark();
+    
+    // If there's not very much contrast between the disabled color and the \
background color, +    // just leave the text color alone.  We don't want to change a \
good contrast color scheme so that it has really bad contrast. +    // If the the \
contrast was already poor, then it doesn't do any good to change it to a different \
poor contrast color scheme. +    if (differenceSquared(disabledColor, \
backgroundColor) &lt; minColorContrastValue) +        return textColor;
+    
+    return disabledColor;
+}
+
</ins><span class="cx"> RenderTextControl::RenderTextControl(Node* node, bool \
multiLine) </span><span class="cx">     : RenderBlock(node)
</span><span class="cx">     , m_dirty(false)
</span><span class="lines">@@ -120,15 +142,6 @@
</span><span class="cx">     setReplaced(isInline());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static Color disabledTextColor(const Color&amp; textColor, const \
                Color&amp; backgroundColor)
-{
-    // The explcit check for black is an optimization for the 99% case (black on \
                white).
-    // This also means that black on black will turn into grey on black when \
                disabled.
-    if (textColor.rgb() == Color::black || differenceSquared(textColor, \
                Color::white) &gt; differenceSquared(backgroundColor, Color::white))
-        return textColor.light();
-    return textColor.dark();
-}
-
</del><span class="cx"> RenderStyle* \
RenderTextControl::createInnerBlockStyle(RenderStyle* startStyle) </span><span \
class="cx"> { </span><span class="cx">     RenderStyle* innerBlockStyle = new \
(renderArena()) RenderStyle(); </span><span class="lines">@@ -190,6 +203,12 @@
</span><span class="cx">         textBlockStyle-&gt;setPaddingLeft(Length(3, Fixed));
</span><span class="cx">         textBlockStyle-&gt;setPaddingRight(Length(3, \
Fixed)); </span><span class="cx">     }
</span><ins>+    
+    // When the placeholder is going to be displayed, temporarily override the text \
security to be &quot;none&quot;. +    // After this, updateFromElement will \
immediately update the text displayed. +    // When the placeholder is no longer \
visible, style will be recomputed, and the text security mode will be set back to the \
computed value correctly. +    if (!m_multiLine &amp;&amp; \
static_cast&lt;HTMLInputElement*&gt;(element)-&gt;placeholderShouldBeVisible()) +     \
textBlockStyle-&gt;setTextSecurity(TSNONE); </ins><span class="cx"> 
</span><span class="cx">     if (!element-&gt;isEnabled())
</span><span class="cx">         \
textBlockStyle-&gt;setColor(disabledTextColor(startStyle-&gt;color(), \
startStyle-&gt;backgroundColor())); </span><span class="lines">@@ -236,50 +255,6 @@
</span><span class="cx">     return cancelBlockStyle;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RenderTextControl::updatePlaceholder()
-{
-    bool oldPlaceholderVisible = m_placeholderVisible;
-    
-    String placeholder;
-    if (!m_multiLine) {
-        HTMLInputElement* input = static_cast&lt;HTMLInputElement*&gt;(node());
-        if (input-&gt;value().isEmpty() &amp;&amp; document()-&gt;focusedNode() != \
                node())
-            placeholder = input-&gt;getAttribute(placeholderAttr);
-    }
-
-    if (!placeholder.isEmpty() || m_placeholderVisible) {
-        ExceptionCode ec = 0;
-        m_innerText-&gt;setInnerText(placeholder, ec);
-        m_placeholderVisible = !placeholder.isEmpty();
-    }
-
-    Color color;
-    if (!placeholder.isEmpty())
-        color = Color::darkGray;
-    else if (node()-&gt;isEnabled())
-        color = style()-&gt;color();
-    else
-        color = disabledTextColor(style()-&gt;color(), \
                style()-&gt;backgroundColor());
-
-    RenderObject* renderer = m_innerText-&gt;renderer();
-    RenderStyle* innerStyle = renderer-&gt;style();
-    if (innerStyle-&gt;color() != color) {
-        innerStyle-&gt;setColor(color);
-        renderer-&gt;repaint();
-    }
-
-    // temporary disable textSecurity if placeholder is visible
-    if (style()-&gt;textSecurity() != TSNONE &amp;&amp; oldPlaceholderVisible != \
                m_placeholderVisible) {
-        RenderStyle* newInnerStyle = new (renderArena()) RenderStyle(*innerStyle);
-        newInnerStyle-&gt;setTextSecurity(m_placeholderVisible ? TSNONE : \
                style()-&gt;textSecurity());
-        renderer-&gt;setStyle(newInnerStyle);
-        for (Node* n = m_innerText-&gt;firstChild(); n; n = \
                n-&gt;traverseNextNode(m_innerText.get())) {
-            if (n-&gt;renderer())
-                n-&gt;renderer()-&gt;setStyle(newInnerStyle);
-        }
-    }
-}
-
</del><span class="cx"> void RenderTextControl::createSubtreeIfNeeded()
</span><span class="cx"> {
</span><span class="cx">     bool isSearchField = !m_multiLine &amp;&amp; \
static_cast&lt;HTMLInputElement*&gt;(node())-&gt;isSearchField(); </span><span \
class="lines">@@ -327,16 +302,21 @@ </span><span class="cx"> {
</span><span class="cx">     HTMLFormControlElement* element = \
static_cast&lt;HTMLFormControlElement*&gt;(node()); </span><span class="cx"> 
</span><ins>+    bool placeholderShouldBeVisible = !m_multiLine &amp;&amp; \
static_cast&lt;HTMLInputElement*&gt;(element)-&gt;placeholderShouldBeVisible(); +    \
bool placeholderVisibilityShouldChange = m_placeholderVisible != \
placeholderShouldBeVisible; +    m_placeholderVisible = placeholderShouldBeVisible;
+
</ins><span class="cx">     createSubtreeIfNeeded();
</span><span class="cx"> 
</span><span class="cx">     if (m_cancelButton &amp;&amp; \
m_cancelButton-&gt;renderer()) </span><span class="cx">         \
updateCancelButtonVisibility(m_cancelButton-&gt;renderer()-&gt;style()); </span><span \
class="cx">  </span><del>-    updatePlaceholder();
-
</del><span class="cx">     \
m_innerText-&gt;renderer()-&gt;style()-&gt;setUserModify(element-&gt;isReadOnlyControl() \
|| element-&gt;disabled() ? READ_ONLY : READ_WRITE_PLAINTEXT_ONLY); </span><del>-
-    if ((!element-&gt;valueMatchesRenderer() || m_multiLine) &amp;&amp; \
!m_placeholderVisible) { </del><ins>+    
+    if (m_placeholderVisible) {
+        ExceptionCode ec;
+        m_innerText-&gt;setInnerText(static_cast&lt;HTMLInputElement*&gt;(element)-&gt;getAttribute(placeholderAttr), \
ec); +    } else if (!element-&gt;valueMatchesRenderer() || m_multiLine || \
placeholderVisibilityShouldChange) { </ins><span class="cx">         String value;
</span><span class="cx">         if (m_multiLine)
</span><span class="cx">             value = \
static_cast&lt;HTMLTextAreaElement*&gt;(element)-&gt;value(); </span><span \
class="lines">@@ -871,12 +851,10 @@ </span><span class="cx">             if \
(innerLayer &amp;&amp; !m_multiLine) </span><span class="cx">                 \
innerLayer-&gt;scrollToOffset(style()-&gt;direction() == RTL ? \
innerLayer-&gt;scrollWidth() : 0, 0); </span><span class="cx">         }
</span><del>-        updatePlaceholder();
</del><span class="cx">         capsLockStateMayHaveChanged();
</span><del>-    } else if (evt-&gt;type() == focusEvent) {
-        updatePlaceholder();
</del><ins>+    } else if (evt-&gt;type() == focusEvent)
</ins><span class="cx">         capsLockStateMayHaveChanged();
</span><del>-    } else {
</del><ins>+    else {
</ins><span class="cx">         if (evt-&gt;isMouseEvent() &amp;&amp; m_resultsButton \
&amp;&amp; static_cast&lt;MouseEvent*&gt;(evt)-&gt;x() &lt; \
m_innerText-&gt;renderer()-&gt;absoluteBoundingBoxRect().x()) </span><span \
class="cx">             m_resultsButton-&gt;defaultEventHandler(evt); </span><span \
class="cx">         else if (evt-&gt;isMouseEvent() &amp;&amp; m_cancelButton \
&amp;&amp; static_cast&lt;MouseEvent*&gt;(evt)-&gt;x() &gt; \
m_innerText-&gt;renderer()-&gt;absoluteBoundingBoxRect().right()) \
</span></span></pre></div> <a id="trunkWebCorerenderingRenderTextControlh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/rendering/RenderTextControl.h (37122 \
=> 37123)</h4> <pre class="diff"><span>
<span class="info">--- trunk/WebCore/rendering/RenderTextControl.h	2008-09-30 \
                23:19:53 UTC (rev 37122)
+++ trunk/WebCore/rendering/RenderTextControl.h	2008-09-30 23:21:50 UTC (rev 37123)
</span><span class="lines">@@ -134,7 +134,6 @@
</span><span class="cx">     RenderStyle* createCancelButtonStyle(RenderStyle* \
startStyle); </span><span class="cx">     RenderStyle* \
createResultsButtonStyle(RenderStyle* startStyle); </span><span class="cx"> 
</span><del>-    void updatePlaceholder();
</del><span class="cx">     void createSubtreeIfNeeded();
</span><span class="cx">     void updateCancelButtonVisibility(RenderStyle*);
</span><span class="cx">     const AtomicString&amp; autosaveName() const;
</span></span></pre>
</div>
</div>

</body>
</html>



_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic