<!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>[172826] 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/172826">172826</a></dd>
<dt>Author</dt> <dd>benjamin@webkit.org</dd>
<dt>Date</dt> <dd>2014-08-20 20:33:18 -0700 (Wed, 20 Aug 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>CSS: Implement the :placeholder-shown pseudo-class from Selectors Level 4
https://bugs.webkit.org/show_bug.cgi?id=118162

Reviewed by Antti Koivisto.

Source/WebCore:

Previously, HTMLTextFormControlElement was using some mix of its own state
and style to change the visibility of the placeholder. That approach was a little
bit too fragile, and we do not want the style to depends on the renderer() since
that creates circular dependencies.

The biggest change here is refactoring HTMLTextFormControlElement to have
1) An explicit &quot;visible placeholder&quot; state.
2) Separate the textUpdate() from the visibilityUpdate().
3) Remove the dependencies between the Element's style and the placeholder's style.
   This is done by simply using display:none; on the placeholder so that its parent's visibility
   is irrelevant.

When matching the selector, the style is set as unique since style sharing does not deal with
the changes of HTMLTextFormControlElement.

Tests: fast/css/placeholder-shown-basics.html
       fast/selectors/placeholder-shown-long-adjacent-backtracking.html
       fast/selectors/placeholder-shown-sibling-style-update.html
       fast/selectors/placeholder-shown-style-update.html
       fast/selectors/placeholder-shown-with-input-basics.html
       fast/selectors/placeholder-shown-with-textarea-basics.html

* css/CSSSelector.cpp:
(WebCore::CSSSelector::selectorText):
Add the CSS Selector description for CSSOM.

* css/CSSSelector.h:
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne):
* css/SelectorCheckerTestFunctions.h:
(WebCore::isPlaceholderShown):
* css/SelectorPseudoClassAndCompatibilityElementMap.in:
* css/html.css:
(::-webkit-input-placeholder):
Previously, the display was forced through the UA stylesheet. Since the display is now part
of the placeholder visibility, it is explicitly handled by HTMLTextFormControlElement and
its subclasses.

* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoClassType):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementMatching):
(WebCore::SelectorCompiler::makeUniqueIfNecessaryAndTestIsPlaceholderShown):
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementHasPlaceholderShown):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::parseAttribute):
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::updateValue):
(WebCore::HTMLTextAreaElement::setValueCommon):
(WebCore::HTMLTextAreaElement::updatePlaceholderText):
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::HTMLTextFormControlElement):
(WebCore::HTMLTextFormControlElement::dispatchFocusEvent):
(WebCore::HTMLTextFormControlElement::dispatchBlurEvent):
(WebCore::HTMLTextFormControlElement::placeholderShouldBeVisible):
(WebCore::HTMLTextFormControlElement::updatePlaceholderVisibility):
(WebCore::HTMLTextFormControlElement::selectionDirection):
(WebCore::HTMLTextFormControlElement::restoreCachedSelection):
(WebCore::HTMLTextFormControlElement::parseAttribute):
(WebCore::HTMLTextFormControlElement::hidePlaceholder):
(WebCore::HTMLTextFormControlElement::showPlaceholderIfNecessary):
* html/HTMLTextFormControlElement.h:
(WebCore::HTMLTextFormControlElement::isPlaceholderVisible):
(WebCore::HTMLTextFormControlElement::cachedSelectionDirection):
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::updatePlaceholderText):
(WebCore::TextFieldInputType::subtreeHasChanged):
(WebCore::TextFieldInputType::updateInnerTextValue):
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::styleDidChange):
* testing/Internals.cpp:
(WebCore::Internals::visiblePlaceholder):

LayoutTests:

Add basic test coverage for common operations: styling, querySelector, CSSOM.

The layout test failure of placeholder-shown-sibling-style-update.html seems unrelated
to this patch, it fails in many more cases. This will be investigated separately, the failure
are used as expected values for now.

* fast/css/css-selector-text-expected.txt:
* fast/css/css-selector-text.html:
* fast/css/css-set-selector-text-expected.txt:
* fast/css/css-set-selector-text.html:
* fast/css/placeholder-shown-basics-expected.html: Added.
* fast/css/placeholder-shown-basics.html: Added.
* fast/selectors/placeholder-shown-long-adjacent-backtracking-expected.txt: Added.
* fast/selectors/placeholder-shown-long-adjacent-backtracking.html: Added.
* fast/selectors/placeholder-shown-sibling-style-update-expected.txt: Added.
* fast/selectors/placeholder-shown-sibling-style-update.html: Added.
* fast/selectors/placeholder-shown-style-update-expected.txt: Added.
* fast/selectors/placeholder-shown-style-update.html: Added.
* fast/selectors/placeholder-shown-with-input-basics-expected.txt: Added.
* fast/selectors/placeholder-shown-with-input-basics.html: Added.
* fast/selectors/placeholder-shown-with-textarea-basics-expected.txt: Added.
* fast/selectors/placeholder-shown-with-textarea-basics.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastcsscssselectortextexpectedtxt">trunk/LayoutTests/fast/css/css-selector-text-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcsscssselectortexthtml">trunk/LayoutTests/fast/css/css-selector-text.html</a></li>
<li><a href="#trunkLayoutTestsfastcsscsssetselectortextexpectedtxt">trunk/LayoutTests/fast/css/css-set-selector-text-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcsscsssetselectortexthtml">trunk/LayoutTests/fast/css/css-set-selector-text.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCorecssCSSSelectorcpp">trunk/Source/WebCore/css/CSSSelector.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSSelectorh">trunk/Source/WebCore/css/CSSSelector.h</a></li>
<li><a href="#trunkSourceWebCorecssSelectorCheckercpp">trunk/Source/WebCore/css/SelectorChecker.cpp</a></li>
<li><a href="#trunkSourceWebCorecssSelectorCheckerTestFunctionsh">trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h</a></li>
<li><a href="#trunkSourceWebCorecssSelectorPseudoClassAndCompatibilityElementMapin">trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in</a></li>
<li><a href="#trunkSourceWebCorecsshtmlcss">trunk/Source/WebCore/css/html.css</a></li>
<li><a href="#trunkSourceWebCorecssjitSelectorCompilercpp">trunk/Source/WebCore/cssjit/SelectorCompiler.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLInputElementcpp">trunk/Source/WebCore/html/HTMLInputElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTextAreaElementcpp">trunk/Source/WebCore/html/HTMLTextAreaElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTextFormControlElementcpp">trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTextFormControlElementh">trunk/Source/WebCore/html/HTMLTextFormControlElement.h</a></li>
<li><a href="#trunkSourceWebCorehtmlTextFieldInputTypecpp">trunk/Source/WebCore/html/TextFieldInputType.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTextControlcpp">trunk/Source/WebCore/rendering/RenderTextControl.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
<li><a href="#trunkSourceWebKitWebKitvcxprojWebKitExportGeneratorWebKitExportsdefin">trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastcssplaceholdershownbasicsexpectedhtml">trunk/LayoutTests/fast/css/placeholder-shown-basics-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastcssplaceholdershownbasicshtml">trunk/LayoutTests/fast/css/placeholder-shown-basics.html</a></li>
<li><a href="#trunkLayoutTestsfastselectorsplaceholdershownlongadjacentbacktrackingexpectedtxt">trunk/LayoutTests/fast/selectors/placeholder-shown-long-adjacent-backtracking-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastselectorsplaceholdershownlongadjacentbacktrackinghtml">trunk/LayoutTests/fast/selectors/placeholder-shown-long-adjacent-backtracking.html</a></li>
<li><a href="#trunkLayoutTestsfastselectorsplaceholdershownsiblingstyleupdateexpectedtxt">trunk/LayoutTests/fast/selectors/placeholder-shown-sibling-style-update-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastselectorsplaceholdershownsiblingstyleupdatehtml">trunk/LayoutTests/fast/selectors/placeholder-shown-sibling-style-update.html</a></li>
<li><a href="#trunkLayoutTestsfastselectorsplaceholdershownstyleupdateexpectedtxt">trunk/LayoutTests/fast/selectors/placeholder-shown-style-update-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastselectorsplaceholdershownstyleupdatehtml">trunk/LayoutTests/fast/selectors/placeholder-shown-style-update.html</a></li>
<li><a href="#trunkLayoutTestsfastselectorsplaceholdershownwithinputbasicsexpectedtxt">trunk/LayoutTests/fast/selectors/placeholder-shown-with-input-basics-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastselectorsplaceholdershownwithinputbasicshtml">trunk/LayoutTests/fast/selectors/placeholder-shown-with-input-basics.html</a></li>
<li><a href="#trunkLayoutTestsfastselectorsplaceholdershownwithtextareabasicsexpectedtxt">trunk/LayoutTests/fast/selectors/placeholder-shown-with-textarea-basics-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastselectorsplaceholdershownwithtextareabasicshtml">trunk/LayoutTests/fast/selectors/placeholder-shown-with-textarea-basics.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/LayoutTests/ChangeLog        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -1,3 +1,33 @@
</span><ins>+2014-08-20  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
+
+        CSS: Implement the :placeholder-shown pseudo-class from Selectors Level 4
+        https://bugs.webkit.org/show_bug.cgi?id=118162
+
+        Reviewed by Antti Koivisto.
+
+        Add basic test coverage for common operations: styling, querySelector, CSSOM.
+
+        The layout test failure of placeholder-shown-sibling-style-update.html seems unrelated
+        to this patch, it fails in many more cases. This will be investigated separately, the failure
+        are used as expected values for now.
+
+        * fast/css/css-selector-text-expected.txt:
+        * fast/css/css-selector-text.html:
+        * fast/css/css-set-selector-text-expected.txt:
+        * fast/css/css-set-selector-text.html:
+        * fast/css/placeholder-shown-basics-expected.html: Added.
+        * fast/css/placeholder-shown-basics.html: Added.
+        * fast/selectors/placeholder-shown-long-adjacent-backtracking-expected.txt: Added.
+        * fast/selectors/placeholder-shown-long-adjacent-backtracking.html: Added.
+        * fast/selectors/placeholder-shown-sibling-style-update-expected.txt: Added.
+        * fast/selectors/placeholder-shown-sibling-style-update.html: Added.
+        * fast/selectors/placeholder-shown-style-update-expected.txt: Added.
+        * fast/selectors/placeholder-shown-style-update.html: Added.
+        * fast/selectors/placeholder-shown-with-input-basics-expected.txt: Added.
+        * fast/selectors/placeholder-shown-with-input-basics.html: Added.
+        * fast/selectors/placeholder-shown-with-textarea-basics-expected.txt: Added.
+        * fast/selectors/placeholder-shown-with-textarea-basics.html: Added.
+
</ins><span class="cx"> 2014-08-20  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove HTMLInputElement's suggestedValue
</span></span></pre></div>
<a id="trunkLayoutTestsfastcsscssselectortextexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css/css-selector-text-expected.txt (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/css-selector-text-expected.txt        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/LayoutTests/fast/css/css-selector-text-expected.txt        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -40,6 +40,8 @@
</span><span class="cx"> PASS parseThenSerializeRule(':hover { }') is ':hover { }'
</span><span class="cx"> PASS parseThenSerializeRule(':indeterminate { }') is ':indeterminate { }'
</span><span class="cx"> PASS parseThenSerializeRule(':link { }') is ':link { }'
</span><ins>+PASS parseThenSerializeRule(':not(:placeholder-shown) { }') is ':not(:placeholder-shown) { }'
+PASS parseThenSerializeRule(':placeholder-shown { }') is ':placeholder-shown { }'
</ins><span class="cx"> PASS parseThenSerializeRule(':root { }') is ':root { }'
</span><span class="cx"> PASS parseThenSerializeRule(':target { }') is ':target { }'
</span><span class="cx"> PASS parseThenSerializeRule(':visited { }') is ':visited { }'
</span></span></pre></div>
<a id="trunkLayoutTestsfastcsscssselectortexthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css/css-selector-text.html (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/css-selector-text.html        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/LayoutTests/fast/css/css-selector-text.html        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -71,6 +71,8 @@
</span><span class="cx"> testSelectorRoundTrip(&quot;:hover&quot;);
</span><span class="cx"> testSelectorRoundTrip(&quot;:indeterminate&quot;);
</span><span class="cx"> testSelectorRoundTrip(&quot;:link&quot;);
</span><ins>+testSelectorRoundTrip(&quot;:not(:placeholder-shown)&quot;);
+testSelectorRoundTrip(&quot;:placeholder-shown&quot;);
</ins><span class="cx"> testSelectorRoundTrip(&quot;:root&quot;);
</span><span class="cx"> testSelectorRoundTrip(&quot;:target&quot;);
</span><span class="cx"> testSelectorRoundTrip(&quot;:visited&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestsfastcsscsssetselectortextexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css/css-set-selector-text-expected.txt (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/css-set-selector-text-expected.txt        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/LayoutTests/fast/css/css-set-selector-text-expected.txt        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -50,6 +50,8 @@
</span><span class="cx"> PASS setThenReadSelectorText(':hover') is ':hover'
</span><span class="cx"> PASS setThenReadSelectorText(':indeterminate') is ':indeterminate'
</span><span class="cx"> PASS setThenReadSelectorText(':link') is ':link'
</span><ins>+PASS setThenReadSelectorText(':not(:placeholder-shown)') is ':not(:placeholder-shown)'
+PASS setThenReadSelectorText(':placeholder-shown') is ':placeholder-shown'
</ins><span class="cx"> PASS setThenReadSelectorText(':root') is ':root'
</span><span class="cx"> PASS setThenReadSelectorText(':target') is ':target'
</span><span class="cx"> PASS setThenReadSelectorText(':visited') is ':visited'
</span></span></pre></div>
<a id="trunkLayoutTestsfastcsscsssetselectortexthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css/css-set-selector-text.html (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/css-set-selector-text.html        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/LayoutTests/fast/css/css-set-selector-text.html        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -88,6 +88,8 @@
</span><span class="cx"> testSelectorRoundTrip(&quot;:hover&quot;);
</span><span class="cx"> testSelectorRoundTrip(&quot;:indeterminate&quot;);
</span><span class="cx"> testSelectorRoundTrip(&quot;:link&quot;);
</span><ins>+testSelectorRoundTrip(&quot;:not(:placeholder-shown)&quot;);
+testSelectorRoundTrip(&quot;:placeholder-shown&quot;);
</ins><span class="cx"> testSelectorRoundTrip(&quot;:root&quot;);
</span><span class="cx"> testSelectorRoundTrip(&quot;:target&quot;);
</span><span class="cx"> testSelectorRoundTrip(&quot;:visited&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssplaceholdershownbasicsexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/placeholder-shown-basics-expected.html (0 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/placeholder-shown-basics-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/placeholder-shown-basics-expected.html        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -0,0 +1,113 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        input, textarea {
+            height: 8px;
+        }
+        .placeholder-shown {
+            background-color: green;
+        }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;p&gt;This test checks how various input elements are styled when :placeholder-shown is applied.&lt;/p&gt;
+    &lt;div&gt;
+        &lt;textarea&gt;&lt;/textarea&gt;
+        &lt;textarea placeholder&gt;&lt;/textarea&gt;
+        &lt;textarea placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;&lt;/textarea&gt;
+        &lt;textarea placeholder=&quot;WebKit&quot;&gt;Foobar&lt;/textarea&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input&gt;
+        &lt;input placeholder&gt;
+        &lt;input placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;&quot;&gt;
+        &lt;input type=&quot;&quot; placeholder&gt;
+        &lt;input type=&quot;&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;hidden&quot;&gt;
+        &lt;input type=&quot;hidden&quot; placeholder&gt;
+        &lt;input type=&quot;hidden&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;hidden&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;text&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;tel&quot;&gt;
+        &lt;input type=&quot;tel&quot; placeholder&gt;
+        &lt;input type=&quot;tel&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;tel&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;url&quot;&gt;
+        &lt;input type=&quot;url&quot; placeholder&gt;
+        &lt;input type=&quot;url&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;url&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;email&quot;&gt;
+        &lt;input type=&quot;email&quot; placeholder&gt;
+        &lt;input type=&quot;email&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;email&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;password&quot;&gt;
+        &lt;input type=&quot;password&quot; placeholder&gt;
+        &lt;input type=&quot;password&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;password&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;datetime&quot;&gt;
+        &lt;input type=&quot;datetime&quot; placeholder&gt;
+        &lt;input type=&quot;datetime&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;datetime&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;number&quot;&gt;
+        &lt;input type=&quot;number&quot; placeholder&gt;
+        &lt;input type=&quot;number&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;number&quot; placeholder=&quot;WebKit&quot; value=&quot;0&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;range&quot;&gt;
+        &lt;input type=&quot;range&quot; placeholder&gt;
+        &lt;input type=&quot;range&quot; placeholder=&quot;WebKit&quot;&gt;
+        &lt;input type=&quot;range&quot; placeholder=&quot;WebKit&quot; value=&quot;1&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;checkbox&quot;&gt;
+        &lt;input type=&quot;checkbox&quot; placeholder&gt;
+        &lt;input type=&quot;checkbox&quot; placeholder=&quot;WebKit&quot;&gt;
+        &lt;input type=&quot;checkbox&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;radio&quot;&gt;
+        &lt;input type=&quot;radio&quot; placeholder&gt;
+        &lt;input type=&quot;radio&quot; placeholder=&quot;WebKit&quot;&gt;
+        &lt;input type=&quot;radio&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;submit&quot;&gt;
+        &lt;input type=&quot;submit&quot; placeholder&gt;
+        &lt;input type=&quot;submit&quot; placeholder=&quot;WebKit&quot;&gt;
+        &lt;input type=&quot;submit&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;color&quot;&gt;
+        &lt;input type=&quot;color&quot; placeholder&gt;
+        &lt;input type=&quot;color&quot; placeholder=&quot;WebKit&quot;&gt;
+        &lt;input type=&quot;color&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssplaceholdershownbasicshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/placeholder-shown-basics.html (0 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/placeholder-shown-basics.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/placeholder-shown-basics.html        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -0,0 +1,113 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        input, textarea {
+            height: 8px;
+        }
+        :placeholder-shown {
+            background-color: green;
+        }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;p&gt;This test checks how various input elements are styled when :placeholder-shown is applied.&lt;/p&gt;
+    &lt;div&gt;
+        &lt;textarea&gt;&lt;/textarea&gt;
+        &lt;textarea placeholder&gt;&lt;/textarea&gt;
+        &lt;textarea placeholder=&quot;WebKit&quot;&gt;&lt;/textarea&gt;
+        &lt;textarea placeholder=&quot;WebKit&quot;&gt;Foobar&lt;/textarea&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input&gt;
+        &lt;input placeholder&gt;
+        &lt;input placeholder=&quot;WebKit&quot;&gt;
+        &lt;input placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;&quot;&gt;
+        &lt;input type=&quot;&quot; placeholder&gt;
+        &lt;input type=&quot;&quot; placeholder=&quot;WebKit&quot;&gt;
+        &lt;input type=&quot;&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;hidden&quot;&gt;
+        &lt;input type=&quot;hidden&quot; placeholder&gt;
+        &lt;input type=&quot;hidden&quot; placeholder=&quot;WebKit&quot;&gt;
+        &lt;input type=&quot;hidden&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;text&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;tel&quot;&gt;
+        &lt;input type=&quot;tel&quot; placeholder&gt;
+        &lt;input type=&quot;tel&quot; placeholder=&quot;WebKit&quot;&gt;
+        &lt;input type=&quot;tel&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;url&quot;&gt;
+        &lt;input type=&quot;url&quot; placeholder&gt;
+        &lt;input type=&quot;url&quot; placeholder=&quot;WebKit&quot;&gt;
+        &lt;input type=&quot;url&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;email&quot;&gt;
+        &lt;input type=&quot;email&quot; placeholder&gt;
+        &lt;input type=&quot;email&quot; placeholder=&quot;WebKit&quot;&gt;
+        &lt;input type=&quot;email&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;password&quot;&gt;
+        &lt;input type=&quot;password&quot; placeholder&gt;
+        &lt;input type=&quot;password&quot; placeholder=&quot;WebKit&quot;&gt;
+        &lt;input type=&quot;password&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;datetime&quot;&gt;
+        &lt;input type=&quot;datetime&quot; placeholder&gt;
+        &lt;input type=&quot;datetime&quot; placeholder=&quot;WebKit&quot;&gt;
+        &lt;input type=&quot;datetime&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;number&quot;&gt;
+        &lt;input type=&quot;number&quot; placeholder&gt;
+        &lt;input type=&quot;number&quot; placeholder=&quot;WebKit&quot;&gt;
+        &lt;input type=&quot;number&quot; placeholder=&quot;WebKit&quot; value=&quot;0&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;range&quot;&gt;
+        &lt;input type=&quot;range&quot; placeholder&gt;
+        &lt;input type=&quot;range&quot; placeholder=&quot;WebKit&quot;&gt;
+        &lt;input type=&quot;range&quot; placeholder=&quot;WebKit&quot; value=&quot;1&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;checkbox&quot;&gt;
+        &lt;input type=&quot;checkbox&quot; placeholder&gt;
+        &lt;input type=&quot;checkbox&quot; placeholder=&quot;WebKit&quot;&gt;
+        &lt;input type=&quot;checkbox&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;radio&quot;&gt;
+        &lt;input type=&quot;radio&quot; placeholder&gt;
+        &lt;input type=&quot;radio&quot; placeholder=&quot;WebKit&quot;&gt;
+        &lt;input type=&quot;radio&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;submit&quot;&gt;
+        &lt;input type=&quot;submit&quot; placeholder&gt;
+        &lt;input type=&quot;submit&quot; placeholder=&quot;WebKit&quot;&gt;
+        &lt;input type=&quot;submit&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+    &lt;div&gt;
+        &lt;input type=&quot;color&quot;&gt;
+        &lt;input type=&quot;color&quot; placeholder&gt;
+        &lt;input type=&quot;color&quot; placeholder=&quot;WebKit&quot;&gt;
+        &lt;input type=&quot;color&quot; placeholder=&quot;WebKit&quot; value=&quot;Foobar&quot;&gt;
+    &lt;/div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsplaceholdershownlongadjacentbacktrackingexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/placeholder-shown-long-adjacent-backtracking-expected.txt (0 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/placeholder-shown-long-adjacent-backtracking-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/selectors/placeholder-shown-long-adjacent-backtracking-expected.txt        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+Test backtracking of a long chain of :placeholder-shown siblings to catch any issue with register allocation.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS document.querySelectorAll(&quot;:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown~:not(:placeholder-shown)&quot;).length is 3
+PASS document.querySelectorAll(&quot;:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown~:not(:placeholder-shown)&quot;)[0] is document.getElementById(&quot;target1&quot;)
+PASS document.querySelectorAll(&quot;:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown~:not(:placeholder-shown)&quot;)[1] is document.getElementById(&quot;target2&quot;)
+PASS document.querySelectorAll(&quot;:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown~:not(:placeholder-shown)&quot;)[2] is document.getElementById(&quot;target3&quot;)
+PASS document.querySelectorAll(&quot;input&quot;).length is 61
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[0]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[1]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[2]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[3]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[4]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[5]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[6]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[7]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[8]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[9]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[10]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[11]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[12]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[13]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[14]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[15]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[16]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[17]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[18]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[19]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[20]).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[21]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[22]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[23]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[24]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[25]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[26]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[27]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[28]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[29]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[30]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[31]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[32]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[33]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[34]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[35]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[36]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[37]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[38]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[39]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[40]).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[41]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[42]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[43]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[44]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[45]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[46]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[47]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[48]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[49]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[50]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[51]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[52]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[53]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[54]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[55]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[56]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[57]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[58]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[59]).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.querySelectorAll(&quot;input&quot;)[60]).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsplaceholdershownlongadjacentbacktrackinghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/placeholder-shown-long-adjacent-backtracking.html (0 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/placeholder-shown-long-adjacent-backtracking.html                                (rev 0)
+++ trunk/LayoutTests/fast/selectors/placeholder-shown-long-adjacent-backtracking.html        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -0,0 +1,104 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;style&gt;
+input {
+    background-color: white;
+}
+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown~:not(:placeholder-shown) {
+    background-color: rgb(1, 2, 3);
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;div style=&quot;display:none&quot;&gt;
+        &lt;!-- 20 empty --&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+
+        &lt;input id=&quot;target1&quot; type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-not-shown&quot; value=&quot;Not Shown!&quot;&gt;
+
+        &lt;!-- 19 empty --&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+
+        &lt;input id=&quot;target2&quot; type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-not-shown&quot; value=&quot;Not Shown!&quot;&gt;
+
+        &lt;!-- 19 empty --&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+        &lt;input type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-shown&quot;&gt;
+
+        &lt;input id=&quot;target3&quot; type=&quot;text&quot; placeholder=&quot;WebKit&quot; class=&quot;placeholder-not-shown&quot; value=&quot;Not Shown!&quot;&gt;
+    &lt;/div&gt;
+&lt;/body&gt;
+&lt;script&gt;
+description('Test backtracking of a long chain of :placeholder-shown siblings to catch any issue with register allocation.');
+
+shouldBe('document.querySelectorAll(&quot;:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown~:not(:placeholder-shown)&quot;).length', '3');
+shouldBe('document.querySelectorAll(&quot;:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown~:not(:placeholder-shown)&quot;)[0]', 'document.getElementById(&quot;target1&quot;)');
+shouldBe('document.querySelectorAll(&quot;:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown~:not(:placeholder-shown)&quot;)[1]', 'document.getElementById(&quot;target2&quot;)');
+shouldBe('document.querySelectorAll(&quot;:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown+:placeholder-shown~:not(:placeholder-shown)&quot;)[2]', 'document.getElementById(&quot;target3&quot;)');
+
+shouldBe('document.querySelectorAll(&quot;input&quot;).length', '61')
+
+var allTestCases = document.querySelectorAll(&quot;input&quot;);
+for (var i = 0; i &lt; 61; ++i)
+    shouldBeEqualToString('getComputedStyle(document.querySelectorAll(&quot;input&quot;)[' + i + ']).backgroundColor', allTestCases[i].classList.contains('placeholder-shown') ? 'rgb(255, 255, 255)' : 'rgb(1, 2, 3)');
+
+
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsplaceholdershownsiblingstyleupdateexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/placeholder-shown-sibling-style-update-expected.txt (0 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/placeholder-shown-sibling-style-update-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/selectors/placeholder-shown-sibling-style-update-expected.txt        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+Test style update of the :placeholder-shown pseudo class.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Initial state is without placehoder.
+PASS getComputedStyle(document.getElementById(&quot;target1&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;target2&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;target3&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;target4&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+Adding a placeholder, the targets should match the style.
+FAIL getComputedStyle(document.getElementById(&quot;target1&quot;)).backgroundColor should be rgb(1, 2, 3). Was rgb(255, 255, 255).
+FAIL getComputedStyle(document.getElementById(&quot;target2&quot;)).backgroundColor should be rgb(1, 2, 3). Was rgb(255, 255, 255).
+FAIL getComputedStyle(document.getElementById(&quot;target3&quot;)).backgroundColor should be rgb(1, 2, 3). Was rgb(255, 255, 255).
+FAIL getComputedStyle(document.getElementById(&quot;target4&quot;)).backgroundColor should be rgb(1, 2, 3). Was rgb(255, 255, 255).
+PASS successfullyParsed is true
+
+TEST COMPLETE
+  
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsplaceholdershownsiblingstyleupdatehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/placeholder-shown-sibling-style-update.html (0 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/placeholder-shown-sibling-style-update.html                                (rev 0)
+++ trunk/LayoutTests/fast/selectors/placeholder-shown-sibling-style-update.html        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;style&gt;
+target {
+    background-color: white;
+}
+:placeholder-shown + target {
+    background-color: rgb(1, 2, 3);
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;div&gt;
+        &lt;input id=&quot;input-with-renderer&quot;&gt;
+        &lt;target id=&quot;target1&quot;&gt;&lt;/target&gt;
+        &lt;textarea id=&quot;textarea-with-renderer&quot;&gt;&lt;/textarea&gt;
+        &lt;target id=&quot;target2&quot;&gt;&lt;/target&gt;
+    &lt;/div&gt;
+    &lt;div style=&quot;display:none;&quot;&gt;
+        &lt;input id=&quot;input-without-renderer&quot;&gt;
+        &lt;target id=&quot;target3&quot;&gt;&lt;/target&gt;
+        &lt;textarea id=&quot;textarea-without-renderer&quot;&gt;&lt;/textarea&gt;
+        &lt;target id=&quot;target4&quot;&gt;&lt;/target&gt;
+    &lt;/div&gt;
+&lt;/body&gt;
+&lt;script&gt;
+description('Test style update of the :placeholder-shown pseudo class.');
+
+function testBackgroundColor(expectMatch) {
+    shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;target1&quot;)).backgroundColor', expectMatch ? 'rgb(1, 2, 3)' : 'rgb(255, 255, 255)');
+    shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;target2&quot;)).backgroundColor', expectMatch ? 'rgb(1, 2, 3)' : 'rgb(255, 255, 255)');
+    shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;target3&quot;)).backgroundColor', expectMatch ? 'rgb(1, 2, 3)' : 'rgb(255, 255, 255)');
+    shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;target4&quot;)).backgroundColor', expectMatch ? 'rgb(1, 2, 3)' : 'rgb(255, 255, 255)');
+}
+
+var inputCaseWithRenderer = document.getElementById(&quot;input-with-renderer&quot;);
+var textareaCaseWithRenderer = document.getElementById(&quot;textarea-with-renderer&quot;);
+var inputCaseWithoutRenderer = document.getElementById(&quot;input-without-renderer&quot;);
+var textareaCaseWithoutRenderer = document.getElementById(&quot;textarea-without-renderer&quot;);
+
+function setAttribute(attribute, value) {
+    inputCaseWithRenderer.setAttribute(attribute, value);
+    textareaCaseWithRenderer.setAttribute(attribute, value);
+    inputCaseWithoutRenderer.setAttribute(attribute, value);
+    textareaCaseWithoutRenderer.setAttribute(attribute, value);
+}
+
+debug(&quot;Initial state is without placehoder.&quot;);
+testBackgroundColor(false);
+
+debug(&quot;Adding a placeholder, the targets should match the style.&quot;);
+setAttribute(&quot;placeholder&quot;, &quot;WebKit&quot;)
+testBackgroundColor(true);
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsplaceholdershownstyleupdateexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/placeholder-shown-style-update-expected.txt (0 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/placeholder-shown-style-update-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/selectors/placeholder-shown-style-update-expected.txt        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+Test style update of the :placeholder-shown pseudo class.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Initial state is without placehoder.
+PASS getComputedStyle(document.getElementById(&quot;input-with-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-with-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;input-without-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-without-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+Adding a valid placeholder matches.
+PASS getComputedStyle(document.getElementById(&quot;input-with-renderer&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-with-renderer&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.getElementById(&quot;input-without-renderer&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-without-renderer&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+Using an invalid placeholder value does not match.
+PASS getComputedStyle(document.getElementById(&quot;input-with-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-with-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;input-without-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-without-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+Adding back a placehoder and an empty value. An empty value does not prevent matching.
+PASS getComputedStyle(document.getElementById(&quot;input-with-renderer&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-with-renderer&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.getElementById(&quot;input-without-renderer&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-without-renderer&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+Changing the type of the input to something that does not support placeholder. The input element should not match.
+PASS getComputedStyle(document.getElementById(&quot;input-with-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-with-renderer&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.getElementById(&quot;input-without-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-without-renderer&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+Changing the type of the input to text should add the style back.
+PASS getComputedStyle(document.getElementById(&quot;input-with-renderer&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-with-renderer&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.getElementById(&quot;input-without-renderer&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-without-renderer&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+Adding a non empty value should remove the style.
+PASS getComputedStyle(document.getElementById(&quot;input-with-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-with-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;input-without-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-without-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+Removing the placeholder, we should not match.
+PASS getComputedStyle(document.getElementById(&quot;input-with-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-with-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;input-without-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-without-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+Removing the value. We should still not match since the placeholder attribute was removed.
+PASS getComputedStyle(document.getElementById(&quot;input-with-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-with-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;input-without-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-without-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+Putting back a value, no reason to match.
+PASS getComputedStyle(document.getElementById(&quot;input-with-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-with-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;input-without-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-without-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+Adding back the placeholder, the value is still there so we cannot match yet.
+PASS getComputedStyle(document.getElementById(&quot;input-with-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-with-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;input-without-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-without-renderer&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+Removing the value. A placeholder was added while the value was up, we should get the style now.
+PASS getComputedStyle(document.getElementById(&quot;input-with-renderer&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-with-renderer&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.getElementById(&quot;input-without-renderer&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.getElementById(&quot;textarea-without-renderer&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+  
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsplaceholdershownstyleupdatehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/placeholder-shown-style-update.html (0 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/placeholder-shown-style-update.html                                (rev 0)
+++ trunk/LayoutTests/fast/selectors/placeholder-shown-style-update.html        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -0,0 +1,115 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;style&gt;
+input, textarea {
+    background-color: white;
+}
+:placeholder-shown {
+    background-color: rgb(1, 2, 3);
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;div&gt;
+        &lt;input id=&quot;input-with-renderer&quot;&gt;
+        &lt;textarea id=&quot;textarea-with-renderer&quot;&gt;&lt;/textarea&gt;
+    &lt;/div&gt;
+    &lt;div style=&quot;display:none;&quot;&gt;
+        &lt;input id=&quot;input-without-renderer&quot;&gt;
+        &lt;textarea id=&quot;textarea-without-renderer&quot;&gt;&lt;/textarea&gt;
+    &lt;/div&gt;
+&lt;/body&gt;
+&lt;script&gt;
+description('Test style update of the :placeholder-shown pseudo class.');
+
+var inputCaseWithRenderer = document.getElementById(&quot;input-with-renderer&quot;);
+var textareaCaseWithRenderer = document.getElementById(&quot;textarea-with-renderer&quot;);
+var inputCaseWithoutRenderer = document.getElementById(&quot;input-without-renderer&quot;);
+var textareaCaseWithoutRenderer = document.getElementById(&quot;textarea-without-renderer&quot;);
+
+function testBackgroundColor(expectMatch) {
+    shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;input-with-renderer&quot;)).backgroundColor', expectMatch ? 'rgb(1, 2, 3)' : 'rgb(255, 255, 255)');
+    shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;textarea-with-renderer&quot;)).backgroundColor', expectMatch ? 'rgb(1, 2, 3)' : 'rgb(255, 255, 255)');
+    shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;input-without-renderer&quot;)).backgroundColor', expectMatch ? 'rgb(1, 2, 3)' : 'rgb(255, 255, 255)');
+    shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;textarea-without-renderer&quot;)).backgroundColor', expectMatch ? 'rgb(1, 2, 3)' : 'rgb(255, 255, 255)');
+}
+
+function setAttribute(attribute, value) {
+    inputCaseWithRenderer.setAttribute(attribute, value);
+    textareaCaseWithRenderer.setAttribute(attribute, value);
+    inputCaseWithoutRenderer.setAttribute(attribute, value);
+    textareaCaseWithoutRenderer.setAttribute(attribute, value);
+}
+
+debug(&quot;Initial state is without placehoder.&quot;);
+testBackgroundColor(false);
+
+debug(&quot;Adding a valid placeholder matches.&quot;);
+setAttribute(&quot;placeholder&quot;, &quot;WebKit!&quot;);
+testBackgroundColor(true);
+
+debug(&quot;Using an invalid placeholder value does not match.&quot;);
+setAttribute(&quot;placeholder&quot;, &quot;\n&quot;);
+testBackgroundColor(false);
+
+debug(&quot;Adding back a placehoder and an empty value. An empty value does not prevent matching.&quot;);
+setAttribute(&quot;placeholder&quot;, &quot;WebKit!&quot;);
+inputCaseWithRenderer.value = &quot;&quot;;
+textareaCaseWithRenderer.appendChild(document.createTextNode(&quot;&quot;));
+inputCaseWithoutRenderer.value = &quot;&quot;;
+textareaCaseWithoutRenderer.appendChild(document.createTextNode(&quot;&quot;));
+testBackgroundColor(true);
+
+debug(&quot;Changing the type of the input to something that does not support placeholder. The input element should not match.&quot;);
+inputCaseWithRenderer.type = &quot;button&quot;;
+inputCaseWithoutRenderer.type = &quot;button&quot;;
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;input-with-renderer&quot;)).backgroundColor', 'rgb(255, 255, 255)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;textarea-with-renderer&quot;)).backgroundColor', 'rgb(1, 2, 3)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;input-without-renderer&quot;)).backgroundColor', 'rgb(255, 255, 255)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;textarea-without-renderer&quot;)).backgroundColor', 'rgb(1, 2, 3)');
+
+debug(&quot;Changing the type of the input to text should add the style back.&quot;);
+inputCaseWithRenderer.type = &quot;text&quot;;
+inputCaseWithoutRenderer.type = &quot;text&quot;;
+testBackgroundColor(true);
+
+debug(&quot;Adding a non empty value should remove the style.&quot;);
+inputCaseWithRenderer.value = &quot;Foobar&quot;;
+textareaCaseWithRenderer.appendChild(document.createTextNode(&quot;Foobar&quot;));
+inputCaseWithoutRenderer.value = &quot;Foobar&quot;;
+textareaCaseWithoutRenderer.appendChild(document.createTextNode(&quot;Foobar&quot;));
+testBackgroundColor(false);
+
+debug(&quot;Removing the placeholder, we should not match.&quot;);
+setAttribute(&quot;placeholder&quot;, &quot;&quot;);
+testBackgroundColor(false);
+
+debug(&quot;Removing the value. We should still not match since the placeholder attribute was removed.&quot;);
+inputCaseWithRenderer.value = &quot;&quot;;
+textareaCaseWithRenderer.removeChild(textareaCaseWithRenderer.lastChild);
+inputCaseWithoutRenderer.value = &quot;&quot;;
+textareaCaseWithoutRenderer.removeChild(textareaCaseWithoutRenderer.lastChild);
+testBackgroundColor(false);
+
+debug(&quot;Putting back a value, no reason to match.&quot;);
+inputCaseWithRenderer.value = &quot;Foobar&quot;;
+textareaCaseWithRenderer.appendChild(document.createTextNode(&quot;Foobar&quot;));
+inputCaseWithoutRenderer.value = &quot;Foobar&quot;;
+textareaCaseWithoutRenderer.appendChild(document.createTextNode(&quot;Foobar&quot;));
+testBackgroundColor(false);
+
+debug(&quot;Adding back the placeholder, the value is still there so we cannot match yet.&quot;);
+setAttribute(&quot;placeholder&quot;, &quot;WebKit!&quot;);
+testBackgroundColor(false);
+
+debug(&quot;Removing the value. A placeholder was added while the value was up, we should get the style now.&quot;);
+inputCaseWithRenderer.value = &quot;&quot;;
+textareaCaseWithRenderer.removeChild(textareaCaseWithRenderer.lastChild);
+inputCaseWithoutRenderer.value = &quot;&quot;;
+textareaCaseWithoutRenderer.removeChild(textareaCaseWithoutRenderer.lastChild);
+testBackgroundColor(true);
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsplaceholdershownwithinputbasicsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/placeholder-shown-with-input-basics-expected.txt (0 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/placeholder-shown-with-input-basics-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/selectors/placeholder-shown-with-input-basics-expected.txt        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+Check the basic features of the &quot;:placeholder-shown&quot; pseudo class with the &lt;input&gt; element.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS document.querySelectorAll(&quot;:placeholder-shown&quot;).length is 3
+PASS document.querySelectorAll(&quot;:placeholder-shown&quot;)[0] is document.getElementById(&quot;valid-placeholder&quot;)
+PASS document.querySelectorAll(&quot;:placeholder-shown&quot;)[1] is document.getElementById(&quot;valid-placeholder-with-empty-value&quot;)
+PASS document.querySelectorAll(&quot;:placeholder-shown&quot;)[2] is document.getElementById(&quot;valid-placeholder-with-empty-value2&quot;)
+PASS getComputedStyle(document.getElementById(&quot;no-placeholder&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;empty-placeholder&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;empty-placeholder2&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;placeholder-contains-only-newline&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;placeholder-contains-only-carriageReturn&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;with-value&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;valid-placeholder&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.getElementById(&quot;valid-placeholder-with-empty-value&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.getElementById(&quot;valid-placeholder-with-empty-value2&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+
+PASS document.querySelectorAll(&quot;input:not(:placeholder-shown)&quot;).length is 6
+PASS document.querySelectorAll(&quot;input:not(:placeholder-shown)&quot;)[0] is document.getElementById(&quot;no-placeholder&quot;)
+PASS document.querySelectorAll(&quot;input:not(:placeholder-shown)&quot;)[1] is document.getElementById(&quot;empty-placeholder&quot;)
+PASS document.querySelectorAll(&quot;input:not(:placeholder-shown)&quot;)[2] is document.getElementById(&quot;empty-placeholder2&quot;)
+PASS document.querySelectorAll(&quot;input:not(:placeholder-shown)&quot;)[3] is document.getElementById(&quot;placeholder-contains-only-newline&quot;)
+PASS document.querySelectorAll(&quot;input:not(:placeholder-shown)&quot;)[4] is document.getElementById(&quot;placeholder-contains-only-carriageReturn&quot;)
+PASS document.querySelectorAll(&quot;input:not(:placeholder-shown)&quot;)[5] is document.getElementById(&quot;with-value&quot;)
+PASS getComputedStyle(document.getElementById(&quot;no-placeholder&quot;)).color is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.getElementById(&quot;empty-placeholder&quot;)).color is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.getElementById(&quot;empty-placeholder2&quot;)).color is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.getElementById(&quot;placeholder-contains-only-newline&quot;)).color is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.getElementById(&quot;placeholder-contains-only-carriageReturn&quot;)).color is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.getElementById(&quot;with-value&quot;)).color is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.getElementById(&quot;valid-placeholder&quot;)).color is &quot;rgb(0, 0, 0)&quot;
+PASS getComputedStyle(document.getElementById(&quot;valid-placeholder-with-empty-value&quot;)).color is &quot;rgb(0, 0, 0)&quot;
+PASS getComputedStyle(document.getElementById(&quot;valid-placeholder-with-empty-value2&quot;)).color is &quot;rgb(0, 0, 0)&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsplaceholdershownwithinputbasicshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/placeholder-shown-with-input-basics.html (0 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/placeholder-shown-with-input-basics.html                                (rev 0)
+++ trunk/LayoutTests/fast/selectors/placeholder-shown-with-input-basics.html        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -0,0 +1,83 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;style&gt;
+input {
+    background-color: white;
+    color: black;
+}
+input:placeholder-shown {
+    background-color: rgb(1, 2, 3);
+}
+input:not(:placeholder-shown) {
+    color: rgb(4, 5, 6);
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;div style=&quot;display:none&quot;&gt;
+        &lt;!-- Does not match: no placeholder defined. --&gt;
+        &lt;input type=&quot;text&quot; id=&quot;no-placeholder&quot;&gt;
+
+        &lt;!-- Does not match: empty placeholder. --&gt;
+        &lt;input type=&quot;text&quot; id=&quot;empty-placeholder&quot; placeholder&gt;
+        &lt;input type=&quot;text&quot; id=&quot;empty-placeholder2&quot; placeholder=&quot;&quot;&gt;
+
+        &lt;!-- Does not match: placeholder contains only newline or carriage return characters. --&gt;
+        &lt;input type=&quot;text&quot; id=&quot;placeholder-contains-only-newline&quot;&gt;
+        &lt;input type=&quot;text&quot; id=&quot;placeholder-contains-only-carriageReturn&quot;&gt;
+
+        &lt;!-- Does not match: the placeholder is not shown when a value is set --&gt;
+        &lt;input type=&quot;text&quot; id=&quot;with-value&quot; placeholder=&quot;WebKit&quot; value=&quot;FooBar&quot;&gt;
+
+        &lt;!-- Valid cases --&gt;
+        &lt;input type=&quot;text&quot; id=&quot;valid-placeholder&quot; placeholder=&quot;WebKit&quot;&gt;
+        &lt;input type=&quot;text&quot; id=&quot;valid-placeholder-with-empty-value&quot; placeholder=&quot;WebKit&quot; value&gt;
+        &lt;input type=&quot;text&quot; id=&quot;valid-placeholder-with-empty-value2&quot; placeholder=&quot;WebKit&quot; value=&quot;&quot;&gt;
+    &lt;/div&gt;
+&lt;/body&gt;
+&lt;script&gt;
+description('Check the basic features of the &quot;:placeholder-shown&quot; pseudo class with the &amp;lt;input&amp;gt; element.');
+
+document.getElementById('placeholder-contains-only-newline').setAttribute('placeholder', '\n');
+document.getElementById('placeholder-contains-only-carriageReturn').setAttribute('placeholder', '\r');
+
+shouldBe('document.querySelectorAll(&quot;:placeholder-shown&quot;).length', '3');
+shouldBe('document.querySelectorAll(&quot;:placeholder-shown&quot;)[0]', 'document.getElementById(&quot;valid-placeholder&quot;)');
+shouldBe('document.querySelectorAll(&quot;:placeholder-shown&quot;)[1]', 'document.getElementById(&quot;valid-placeholder-with-empty-value&quot;)');
+shouldBe('document.querySelectorAll(&quot;:placeholder-shown&quot;)[2]', 'document.getElementById(&quot;valid-placeholder-with-empty-value2&quot;)');
+
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;no-placeholder&quot;)).backgroundColor', 'rgb(255, 255, 255)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;empty-placeholder&quot;)).backgroundColor', 'rgb(255, 255, 255)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;empty-placeholder2&quot;)).backgroundColor', 'rgb(255, 255, 255)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;placeholder-contains-only-newline&quot;)).backgroundColor', 'rgb(255, 255, 255)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;placeholder-contains-only-carriageReturn&quot;)).backgroundColor', 'rgb(255, 255, 255)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;with-value&quot;)).backgroundColor', 'rgb(255, 255, 255)');
+
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;valid-placeholder&quot;)).backgroundColor', 'rgb(1, 2, 3)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;valid-placeholder-with-empty-value&quot;)).backgroundColor', 'rgb(1, 2, 3)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;valid-placeholder-with-empty-value2&quot;)).backgroundColor', 'rgb(1, 2, 3)');
+
+debug(&quot;&quot;);
+shouldBe('document.querySelectorAll(&quot;input:not(:placeholder-shown)&quot;).length', '6');
+shouldBe('document.querySelectorAll(&quot;input:not(:placeholder-shown)&quot;)[0]', 'document.getElementById(&quot;no-placeholder&quot;)');
+shouldBe('document.querySelectorAll(&quot;input:not(:placeholder-shown)&quot;)[1]', 'document.getElementById(&quot;empty-placeholder&quot;)');
+shouldBe('document.querySelectorAll(&quot;input:not(:placeholder-shown)&quot;)[2]', 'document.getElementById(&quot;empty-placeholder2&quot;)');
+shouldBe('document.querySelectorAll(&quot;input:not(:placeholder-shown)&quot;)[3]', 'document.getElementById(&quot;placeholder-contains-only-newline&quot;)');
+shouldBe('document.querySelectorAll(&quot;input:not(:placeholder-shown)&quot;)[4]', 'document.getElementById(&quot;placeholder-contains-only-carriageReturn&quot;)');
+shouldBe('document.querySelectorAll(&quot;input:not(:placeholder-shown)&quot;)[5]', 'document.getElementById(&quot;with-value&quot;)');
+
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;no-placeholder&quot;)).color', 'rgb(4, 5, 6)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;empty-placeholder&quot;)).color', 'rgb(4, 5, 6)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;empty-placeholder2&quot;)).color', 'rgb(4, 5, 6)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;placeholder-contains-only-newline&quot;)).color', 'rgb(4, 5, 6)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;placeholder-contains-only-carriageReturn&quot;)).color', 'rgb(4, 5, 6)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;with-value&quot;)).color', 'rgb(4, 5, 6)');
+
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;valid-placeholder&quot;)).color', 'rgb(0, 0, 0)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;valid-placeholder-with-empty-value&quot;)).color', 'rgb(0, 0, 0)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;valid-placeholder-with-empty-value2&quot;)).color', 'rgb(0, 0, 0)');
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsplaceholdershownwithtextareabasicsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/placeholder-shown-with-textarea-basics-expected.txt (0 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/placeholder-shown-with-textarea-basics-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/selectors/placeholder-shown-with-textarea-basics-expected.txt        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+Check the basic features of the &quot;:placeholder-shown&quot; pseudo class with the &lt;textarea&gt; element.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS document.querySelectorAll(&quot;:placeholder-shown&quot;).length is 4
+PASS document.querySelectorAll(&quot;:placeholder-shown&quot;)[0] is document.getElementById(&quot;valid-placeholder&quot;)
+PASS document.querySelectorAll(&quot;:placeholder-shown&quot;)[1] is document.getElementById(&quot;valid-placeholder-with-value-attribute&quot;)
+PASS document.querySelectorAll(&quot;:placeholder-shown&quot;)[2] is document.getElementById(&quot;valid-placeholder-with-value-attribute2&quot;)
+PASS document.querySelectorAll(&quot;:placeholder-shown&quot;)[3] is document.getElementById(&quot;valid-placeholder-with-value-attribute3&quot;)
+PASS getComputedStyle(document.getElementById(&quot;no-placeholder&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;empty-placeholder&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;empty-placeholder2&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;placeholder-contains-only-newline&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;placeholder-contains-only-carriageReturn&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;with-value&quot;)).backgroundColor is &quot;rgb(255, 255, 255)&quot;
+PASS getComputedStyle(document.getElementById(&quot;valid-placeholder&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.getElementById(&quot;valid-placeholder-with-value-attribute&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.getElementById(&quot;valid-placeholder-with-value-attribute2&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+PASS getComputedStyle(document.getElementById(&quot;valid-placeholder-with-value-attribute3&quot;)).backgroundColor is &quot;rgb(1, 2, 3)&quot;
+
+PASS document.querySelectorAll(&quot;textarea:not(:placeholder-shown)&quot;).length is 6
+PASS document.querySelectorAll(&quot;textarea:not(:placeholder-shown)&quot;)[0] is document.getElementById(&quot;no-placeholder&quot;)
+PASS document.querySelectorAll(&quot;textarea:not(:placeholder-shown)&quot;)[1] is document.getElementById(&quot;empty-placeholder&quot;)
+PASS document.querySelectorAll(&quot;textarea:not(:placeholder-shown)&quot;)[2] is document.getElementById(&quot;empty-placeholder2&quot;)
+PASS document.querySelectorAll(&quot;textarea:not(:placeholder-shown)&quot;)[3] is document.getElementById(&quot;placeholder-contains-only-newline&quot;)
+PASS document.querySelectorAll(&quot;textarea:not(:placeholder-shown)&quot;)[4] is document.getElementById(&quot;placeholder-contains-only-carriageReturn&quot;)
+PASS document.querySelectorAll(&quot;textarea:not(:placeholder-shown)&quot;)[5] is document.getElementById(&quot;with-value&quot;)
+PASS getComputedStyle(document.getElementById(&quot;no-placeholder&quot;)).color is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.getElementById(&quot;empty-placeholder&quot;)).color is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.getElementById(&quot;empty-placeholder2&quot;)).color is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.getElementById(&quot;placeholder-contains-only-newline&quot;)).color is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.getElementById(&quot;placeholder-contains-only-carriageReturn&quot;)).color is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.getElementById(&quot;with-value&quot;)).color is &quot;rgb(4, 5, 6)&quot;
+PASS getComputedStyle(document.getElementById(&quot;valid-placeholder&quot;)).color is &quot;rgb(0, 0, 0)&quot;
+PASS getComputedStyle(document.getElementById(&quot;valid-placeholder-with-value-attribute&quot;)).color is &quot;rgb(0, 0, 0)&quot;
+PASS getComputedStyle(document.getElementById(&quot;valid-placeholder-with-value-attribute2&quot;)).color is &quot;rgb(0, 0, 0)&quot;
+PASS getComputedStyle(document.getElementById(&quot;valid-placeholder-with-value-attribute3&quot;)).color is &quot;rgb(0, 0, 0)&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsplaceholdershownwithtextareabasicshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/placeholder-shown-with-textarea-basics.html (0 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/placeholder-shown-with-textarea-basics.html                                (rev 0)
+++ trunk/LayoutTests/fast/selectors/placeholder-shown-with-textarea-basics.html        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -0,0 +1,89 @@
</span><ins>+&lt;!doctype html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;style&gt;
+textarea {
+    background-color: white;
+    color: black;
+}
+textarea:placeholder-shown {
+    background-color: rgb(1, 2, 3);
+}
+textarea:not(:placeholder-shown) {
+    color: rgb(4, 5, 6);
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;div style=&quot;display:none&quot;&gt;
+        &lt;!-- Does not match: no placeholder defined. --&gt;
+        &lt;textarea id=&quot;no-placeholder&quot;&gt;&lt;/textarea&gt;
+
+        &lt;!-- Does not match: empty placeholder. --&gt;
+        &lt;textarea id=&quot;empty-placeholder&quot; placeholder&gt;&lt;/textarea&gt;
+        &lt;textarea id=&quot;empty-placeholder2&quot; placeholder=&quot;&quot;&gt;&lt;/textarea&gt;
+
+        &lt;!-- Does not match: placeholder contains only newline or carriage return characters. --&gt;
+        &lt;textarea id=&quot;placeholder-contains-only-newline&quot;&gt;&lt;/textarea&gt;
+        &lt;textarea id=&quot;placeholder-contains-only-carriageReturn&quot;&gt;&lt;/textarea&gt;
+
+        &lt;!-- Does not match: the placeholder is not shown when a value is set --&gt;
+        &lt;textarea id=&quot;with-value&quot; placeholder=&quot;WebKit&quot;&gt;FooBar&lt;/textarea&gt;
+
+        &lt;!-- Valid cases --&gt;
+        &lt;textarea id=&quot;valid-placeholder&quot; placeholder=&quot;WebKit&quot;&gt;&lt;/textarea&gt;
+
+        &lt;!-- Value does not do anything on &lt;textarea&gt;, the content is the innerText --&gt;
+        &lt;textarea id=&quot;valid-placeholder-with-value-attribute&quot; placeholder=&quot;WebKit&quot; value&gt;&lt;/textarea&gt;
+        &lt;textarea id=&quot;valid-placeholder-with-value-attribute2&quot; placeholder=&quot;WebKit&quot; value=&quot;&quot;&gt;&lt;/textarea&gt;
+        &lt;textarea id=&quot;valid-placeholder-with-value-attribute3&quot; placeholder=&quot;WebKit&quot; value=&quot;Rocks!&quot;&gt;&lt;/textarea&gt;
+    &lt;/div&gt;
+&lt;/body&gt;
+&lt;script&gt;
+description('Check the basic features of the &quot;:placeholder-shown&quot; pseudo class with the &amp;lt;textarea&amp;gt; element.');
+
+document.getElementById('placeholder-contains-only-newline').setAttribute('placeholder', '\n');
+document.getElementById('placeholder-contains-only-carriageReturn').setAttribute('placeholder', '\r');
+
+shouldBe('document.querySelectorAll(&quot;:placeholder-shown&quot;).length', '4');
+shouldBe('document.querySelectorAll(&quot;:placeholder-shown&quot;)[0]', 'document.getElementById(&quot;valid-placeholder&quot;)');
+shouldBe('document.querySelectorAll(&quot;:placeholder-shown&quot;)[1]', 'document.getElementById(&quot;valid-placeholder-with-value-attribute&quot;)');
+shouldBe('document.querySelectorAll(&quot;:placeholder-shown&quot;)[2]', 'document.getElementById(&quot;valid-placeholder-with-value-attribute2&quot;)');
+shouldBe('document.querySelectorAll(&quot;:placeholder-shown&quot;)[3]', 'document.getElementById(&quot;valid-placeholder-with-value-attribute3&quot;)');
+
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;no-placeholder&quot;)).backgroundColor', 'rgb(255, 255, 255)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;empty-placeholder&quot;)).backgroundColor', 'rgb(255, 255, 255)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;empty-placeholder2&quot;)).backgroundColor', 'rgb(255, 255, 255)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;placeholder-contains-only-newline&quot;)).backgroundColor', 'rgb(255, 255, 255)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;placeholder-contains-only-carriageReturn&quot;)).backgroundColor', 'rgb(255, 255, 255)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;with-value&quot;)).backgroundColor', 'rgb(255, 255, 255)');
+
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;valid-placeholder&quot;)).backgroundColor', 'rgb(1, 2, 3)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;valid-placeholder-with-value-attribute&quot;)).backgroundColor', 'rgb(1, 2, 3)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;valid-placeholder-with-value-attribute2&quot;)).backgroundColor', 'rgb(1, 2, 3)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;valid-placeholder-with-value-attribute3&quot;)).backgroundColor', 'rgb(1, 2, 3)');
+
+debug(&quot;&quot;);
+shouldBe('document.querySelectorAll(&quot;textarea:not(:placeholder-shown)&quot;).length', '6');
+shouldBe('document.querySelectorAll(&quot;textarea:not(:placeholder-shown)&quot;)[0]', 'document.getElementById(&quot;no-placeholder&quot;)');
+shouldBe('document.querySelectorAll(&quot;textarea:not(:placeholder-shown)&quot;)[1]', 'document.getElementById(&quot;empty-placeholder&quot;)');
+shouldBe('document.querySelectorAll(&quot;textarea:not(:placeholder-shown)&quot;)[2]', 'document.getElementById(&quot;empty-placeholder2&quot;)');
+shouldBe('document.querySelectorAll(&quot;textarea:not(:placeholder-shown)&quot;)[3]', 'document.getElementById(&quot;placeholder-contains-only-newline&quot;)');
+shouldBe('document.querySelectorAll(&quot;textarea:not(:placeholder-shown)&quot;)[4]', 'document.getElementById(&quot;placeholder-contains-only-carriageReturn&quot;)');
+shouldBe('document.querySelectorAll(&quot;textarea:not(:placeholder-shown)&quot;)[5]', 'document.getElementById(&quot;with-value&quot;)');
+
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;no-placeholder&quot;)).color', 'rgb(4, 5, 6)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;empty-placeholder&quot;)).color', 'rgb(4, 5, 6)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;empty-placeholder2&quot;)).color', 'rgb(4, 5, 6)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;placeholder-contains-only-newline&quot;)).color', 'rgb(4, 5, 6)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;placeholder-contains-only-carriageReturn&quot;)).color', 'rgb(4, 5, 6)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;with-value&quot;)).color', 'rgb(4, 5, 6)');
+
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;valid-placeholder&quot;)).color', 'rgb(0, 0, 0)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;valid-placeholder-with-value-attribute&quot;)).color', 'rgb(0, 0, 0)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;valid-placeholder-with-value-attribute2&quot;)).color', 'rgb(0, 0, 0)');
+shouldBeEqualToString('getComputedStyle(document.getElementById(&quot;valid-placeholder-with-value-attribute3&quot;)).color', 'rgb(0, 0, 0)');
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/Source/WebCore/ChangeLog        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -1,3 +1,82 @@
</span><ins>+2014-08-20  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
+
+        CSS: Implement the :placeholder-shown pseudo-class from Selectors Level 4
+        https://bugs.webkit.org/show_bug.cgi?id=118162
+
+        Reviewed by Antti Koivisto.
+
+        Previously, HTMLTextFormControlElement was using some mix of its own state
+        and style to change the visibility of the placeholder. That approach was a little
+        bit too fragile, and we do not want the style to depends on the renderer() since
+        that creates circular dependencies.
+
+        The biggest change here is refactoring HTMLTextFormControlElement to have
+        1) An explicit &quot;visible placeholder&quot; state.
+        2) Separate the textUpdate() from the visibilityUpdate().
+        3) Remove the dependencies between the Element's style and the placeholder's style.
+           This is done by simply using display:none; on the placeholder so that its parent's visibility
+           is irrelevant.
+
+        When matching the selector, the style is set as unique since style sharing does not deal with
+        the changes of HTMLTextFormControlElement.
+
+        Tests: fast/css/placeholder-shown-basics.html
+               fast/selectors/placeholder-shown-long-adjacent-backtracking.html
+               fast/selectors/placeholder-shown-sibling-style-update.html
+               fast/selectors/placeholder-shown-style-update.html
+               fast/selectors/placeholder-shown-with-input-basics.html
+               fast/selectors/placeholder-shown-with-textarea-basics.html
+
+        * css/CSSSelector.cpp:
+        (WebCore::CSSSelector::selectorText):
+        Add the CSS Selector description for CSSOM.
+
+        * css/CSSSelector.h:
+        * css/SelectorChecker.cpp:
+        (WebCore::SelectorChecker::checkOne):
+        * css/SelectorCheckerTestFunctions.h:
+        (WebCore::isPlaceholderShown):
+        * css/SelectorPseudoClassAndCompatibilityElementMap.in:
+        * css/html.css:
+        (::-webkit-input-placeholder):
+        Previously, the display was forced through the UA stylesheet. Since the display is now part
+        of the placeholder visibility, it is explicitly handled by HTMLTextFormControlElement and
+        its subclasses.
+
+        * cssjit/SelectorCompiler.cpp:
+        (WebCore::SelectorCompiler::addPseudoClassType):
+        (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementMatching):
+        (WebCore::SelectorCompiler::makeUniqueIfNecessaryAndTestIsPlaceholderShown):
+        (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementHasPlaceholderShown):
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::parseAttribute):
+        * html/HTMLTextAreaElement.cpp:
+        (WebCore::HTMLTextAreaElement::updateValue):
+        (WebCore::HTMLTextAreaElement::setValueCommon):
+        (WebCore::HTMLTextAreaElement::updatePlaceholderText):
+        * html/HTMLTextFormControlElement.cpp:
+        (WebCore::HTMLTextFormControlElement::HTMLTextFormControlElement):
+        (WebCore::HTMLTextFormControlElement::dispatchFocusEvent):
+        (WebCore::HTMLTextFormControlElement::dispatchBlurEvent):
+        (WebCore::HTMLTextFormControlElement::placeholderShouldBeVisible):
+        (WebCore::HTMLTextFormControlElement::updatePlaceholderVisibility):
+        (WebCore::HTMLTextFormControlElement::selectionDirection):
+        (WebCore::HTMLTextFormControlElement::restoreCachedSelection):
+        (WebCore::HTMLTextFormControlElement::parseAttribute):
+        (WebCore::HTMLTextFormControlElement::hidePlaceholder):
+        (WebCore::HTMLTextFormControlElement::showPlaceholderIfNecessary):
+        * html/HTMLTextFormControlElement.h:
+        (WebCore::HTMLTextFormControlElement::isPlaceholderVisible):
+        (WebCore::HTMLTextFormControlElement::cachedSelectionDirection):
+        * html/TextFieldInputType.cpp:
+        (WebCore::TextFieldInputType::updatePlaceholderText):
+        (WebCore::TextFieldInputType::subtreeHasChanged):
+        (WebCore::TextFieldInputType::updateInnerTextValue):
+        * rendering/RenderTextControl.cpp:
+        (WebCore::RenderTextControl::styleDidChange):
+        * testing/Internals.cpp:
+        (WebCore::Internals::visiblePlaceholder):
+
</ins><span class="cx"> 2014-08-20  Mark Rowe  &lt;mrowe@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix the release build after r172806.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -1852,7 +1852,6 @@
</span><span class="cx"> __ZNK7WebCore23FrameLoaderStateMachine15firstLayoutDoneEv
</span><span class="cx"> __ZNK7WebCore23FrameLoaderStateMachine23committingFirstRealLoadEv
</span><span class="cx"> __ZNK7WebCore26HTMLTextFormControlElement21lastChangeWasUserEditEv
</span><del>-__ZNK7WebCore26HTMLTextFormControlElement26placeholderShouldBeVisibleEv
</del><span class="cx"> __ZNK7WebCore26NetscapePlugInStreamLoader6isDoneEv
</span><span class="cx"> __ZNK7WebCore27AuthenticationChallengeBase15failureResponseEv
</span><span class="cx"> __ZNK7WebCore27AuthenticationChallengeBase15protectionSpaceEv
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSSelectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSSelector.cpp (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSSelector.cpp        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/Source/WebCore/css/CSSSelector.cpp        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -417,6 +417,11 @@
</span><span class="cx">             case CSSSelector::PseudoClassOptional:
</span><span class="cx">                 str.appendLiteral(&quot;:optional&quot;);
</span><span class="cx">                 break;
</span><ins>+#if ENABLE(CSS_SELECTORS_LEVEL4)
+            case CSSSelector::PseudoClassPlaceholderShown:
+                str.appendLiteral(&quot;:placeholder-shown&quot;);
+                break;
+#endif
</ins><span class="cx">             case CSSSelector::PseudoClassOutOfRange:
</span><span class="cx">                 str.appendLiteral(&quot;:out-of-range&quot;);
</span><span class="cx">                 break;
</span><span class="lines">@@ -461,7 +466,7 @@
</span><span class="cx">             case CSSSelector::PseudoClassWindowInactive:
</span><span class="cx">                 str.appendLiteral(&quot;:window-inactive&quot;);
</span><span class="cx">                 break;
</span><del>-            default:
</del><ins>+            case CSSSelector::PseudoClassUnknown:
</ins><span class="cx">                 ASSERT_NOT_REACHED();
</span><span class="cx">             }
</span><span class="cx">         } else if (cs-&gt;m_match == CSSSelector::PseudoElement) {
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSSelectorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSSelector.h (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSSelector.h        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/Source/WebCore/css/CSSSelector.h        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
</span><span class="cx">  *               1999 Waldo Bastian (bastian@kde.org)
</span><del>- * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 2013, 2014 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="cx">  * modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -106,6 +106,9 @@
</span><span class="cx">             PseudoClassDefault,
</span><span class="cx">             PseudoClassDisabled,
</span><span class="cx">             PseudoClassOptional,
</span><ins>+#if ENABLE(CSS_SELECTORS_LEVEL4)
+            PseudoClassPlaceholderShown,
+#endif
</ins><span class="cx">             PseudoClassRequired,
</span><span class="cx">             PseudoClassReadOnly,
</span><span class="cx">             PseudoClassReadWrite,
</span></span></pre></div>
<a id="trunkSourceWebCorecssSelectorCheckercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SelectorChecker.cpp        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -604,6 +604,14 @@
</span><span class="cx">                 return isFirstOfType(element, element-&gt;tagQName()) &amp;&amp; isLastOfType(element, element-&gt;tagQName());
</span><span class="cx">             }
</span><span class="cx">             break;
</span><ins>+#if ENABLE(CSS_SELECTORS_LEVEL4)
+        case CSSSelector::PseudoClassPlaceholderShown:
+            if (m_mode == Mode::ResolvingStyle) {
+                if (RenderStyle* style = context.elementStyle ? context.elementStyle : element-&gt;renderStyle())
+                    style-&gt;setUnique();
+            }
+            return isPlaceholderShown(element);
+#endif
</ins><span class="cx">         case CSSSelector::PseudoClassNthChild:
</span><span class="cx">             if (!selector-&gt;parseNth())
</span><span class="cx">                 break;
</span></span></pre></div>
<a id="trunkSourceWebCorecssSelectorCheckerTestFunctionsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -114,6 +114,15 @@
</span><span class="cx">     return element-&gt;isOptionalFormControl();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(CSS_SELECTORS_LEVEL4)
+ALWAYS_INLINE bool isPlaceholderShown(Element* element)
+{
+    if (isHTMLTextFormControlElement(*element))
+        return toHTMLTextFormControlElement(*element).isPlaceholderVisible();
+    return false;
+}
+#endif
+
</ins><span class="cx"> ALWAYS_INLINE bool isRequiredFormControl(const Element* element)
</span><span class="cx"> {
</span><span class="cx">     return element-&gt;isRequiredFormControl();
</span></span></pre></div>
<a id="trunkSourceWebCorecssSelectorPseudoClassAndCompatibilityElementMapin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -41,6 +41,9 @@
</span><span class="cx"> only-of-type
</span><span class="cx"> optional
</span><span class="cx"> out-of-range
</span><ins>+#if ENABLE(CSS_SELECTORS_LEVEL4)
+placeholder-shown
+#endif
</ins><span class="cx"> read-only
</span><span class="cx"> read-write
</span><span class="cx"> required
</span></span></pre></div>
<a id="trunkSourceWebCorecsshtmlcss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/html.css (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/html.css        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/Source/WebCore/css/html.css        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -611,7 +611,6 @@
</span><span class="cx"> ::-webkit-input-placeholder {
</span><span class="cx">     -webkit-text-security: none;
</span><span class="cx">     color: darkGray;
</span><del>-    display: block !important;
</del><span class="cx">     pointer-events: none !important;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssjitSelectorCompilercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.cpp (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/cssjit/SelectorCompiler.cpp        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.cpp        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -244,6 +244,9 @@
</span><span class="cx">     void generateElementIsInLanguage(Assembler::JumpList&amp; failureCases, const AtomicString&amp;);
</span><span class="cx">     void generateElementIsLastChild(Assembler::JumpList&amp; failureCases, const SelectorFragment&amp;);
</span><span class="cx">     void generateElementIsOnlyChild(Assembler::JumpList&amp; failureCases, const SelectorFragment&amp;);
</span><ins>+#if ENABLE(CSS_SELECTORS_LEVEL4)
+    void generateElementHasPlaceholderShown(Assembler::JumpList&amp; failureCases, const SelectorFragment&amp;);
+#endif
</ins><span class="cx">     void generateSynchronizeStyleAttribute(Assembler::RegisterID elementDataArraySizeAndFlags);
</span><span class="cx">     void generateSynchronizeAllAnimatedSVGAttribute(Assembler::RegisterID elementDataArraySizeAndFlags);
</span><span class="cx">     void generateElementAttributesMatching(Assembler::JumpList&amp; failureCases, const LocalRegister&amp; elementDataAddress, const SelectorFragment&amp;);
</span><span class="lines">@@ -536,6 +539,9 @@
</span><span class="cx">     case CSSSelector::PseudoClassHover:
</span><span class="cx">     case CSSSelector::PseudoClassLastChild:
</span><span class="cx">     case CSSSelector::PseudoClassOnlyChild:
</span><ins>+#if ENABLE(CSS_SELECTORS_LEVEL4)
+    case CSSSelector::PseudoClassPlaceholderShown:
+#endif
</ins><span class="cx">         fragment.pseudoClasses.add(type);
</span><span class="cx">         if (selectorContext == SelectorContext::QuerySelector)
</span><span class="cx">             return FunctionType::SimpleSelectorChecker;
</span><span class="lines">@@ -1972,6 +1978,10 @@
</span><span class="cx">         generateElementIsHovered(matchingPostTagNameFailureCases, fragment);
</span><span class="cx">     if (fragment.pseudoClasses.contains(CSSSelector::PseudoClassOnlyChild))
</span><span class="cx">         generateElementIsOnlyChild(matchingPostTagNameFailureCases, fragment);
</span><ins>+#if ENABLE(CSS_SELECTORS_LEVEL4)
+    if (fragment.pseudoClasses.contains(CSSSelector::PseudoClassPlaceholderShown))
+        generateElementHasPlaceholderShown(matchingPostTagNameFailureCases, fragment);
+#endif
</ins><span class="cx">     if (fragment.pseudoClasses.contains(CSSSelector::PseudoClassFirstChild))
</span><span class="cx">         generateElementIsFirstChild(matchingPostTagNameFailureCases, fragment);
</span><span class="cx">     if (fragment.pseudoClasses.contains(CSSSelector::PseudoClassLastChild))
</span><span class="lines">@@ -2798,6 +2808,51 @@
</span><span class="cx">     failureCases.append(m_assembler.branchTest32(Assembler::NonZero, isOnlyChildRegister));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(CSS_SELECTORS_LEVEL4)
+static bool makeUniqueIfNecessaryAndTestIsPlaceholderShown(Element* element, const CheckingContext* checkingContext)
+{
+    if (checkingContext-&gt;resolvingMode == SelectorChecker::Mode::ResolvingStyle) {
+        if (RenderStyle* style = element-&gt;renderStyle())
+            style-&gt;setUnique();
+    }
+    return isPlaceholderShown(element);
+}
+
+void SelectorCodeGenerator::generateElementHasPlaceholderShown(Assembler::JumpList&amp; failureCases, const SelectorFragment&amp; fragment)
+{
+    if (m_selectorContext == SelectorContext::QuerySelector) {
+        FunctionCall functionCall(m_assembler, m_registerAllocator, m_stackAllocator, m_functionCalls);
+        functionCall.setFunctionAddress(isPlaceholderShown);
+        functionCall.setOneArgument(elementAddressRegister);
+        failureCases.append(functionCall.callAndBranchOnBooleanReturnValue(Assembler::Zero));
+        return;
+    }
+
+    if (fragmentMatchesTheRightmostElement(m_selectorContext, fragment)) {
+        {
+            LocalRegister checkingContext(m_registerAllocator);
+            Assembler::Jump notResolvingStyle = jumpIfNotResolvingStyle(checkingContext);
+            addFlagsToElementStyleFromContext(checkingContext, RenderStyle::NonInheritedFlags::flagIsUnique());
+            notResolvingStyle.link(&amp;m_assembler);
+        }
+
+        FunctionCall functionCall(m_assembler, m_registerAllocator, m_stackAllocator, m_functionCalls);
+        functionCall.setFunctionAddress(isPlaceholderShown);
+        functionCall.setOneArgument(elementAddressRegister);
+        failureCases.append(functionCall.callAndBranchOnBooleanReturnValue(Assembler::Zero));
+    } else {
+        Assembler::RegisterID checkingContext = m_registerAllocator.allocateRegisterWithPreference(JSC::GPRInfo::argumentGPR1);
+        loadCheckingContext(checkingContext);
+        m_registerAllocator.deallocateRegister(checkingContext);
+
+        FunctionCall functionCall(m_assembler, m_registerAllocator, m_stackAllocator, m_functionCalls);
+        functionCall.setFunctionAddress(makeUniqueIfNecessaryAndTestIsPlaceholderShown);
+        functionCall.setTwoArguments(elementAddressRegister, checkingContext);
+        failureCases.append(functionCall.callAndBranchOnBooleanReturnValue(Assembler::Zero));
+    }
+}
+#endif
+
</ins><span class="cx"> inline void SelectorCodeGenerator::generateElementHasTagName(Assembler::JumpList&amp; failureCases, const QualifiedName&amp; nameToMatch)
</span><span class="cx"> {
</span><span class="cx">     if (nameToMatch == anyQName())
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLInputElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLInputElement.cpp        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -636,7 +636,7 @@
</span><span class="cx">         }
</span><span class="cx">         // We only need to setChanged if the form is looking at the default value right now.
</span><span class="cx">         if (!hasDirtyValue()) {
</span><del>-            updatePlaceholderVisibility(false);
</del><ins>+            updatePlaceholderVisibility();
</ins><span class="cx">             setNeedsStyleRecalc();
</span><span class="cx">         }
</span><span class="cx">         setFormControlValueMatchesRenderer(false);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTextAreaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTextAreaElement.cpp (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTextAreaElement.cpp        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/Source/WebCore/html/HTMLTextAreaElement.cpp        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx">  * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
</span><span class="cx">  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
</span><span class="cx">  *           (C) 2001 Dirk Mueller (mueller@kde.org)
</span><del>- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2014 Apple Inc. All rights reserved.
</ins><span class="cx">  *           (C) 2006 Alexey Proskuryakov (ap@nypop.com)
</span><span class="cx">  * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
</span><span class="cx">  *
</span><span class="lines">@@ -345,7 +345,7 @@
</span><span class="cx">     const_cast&lt;HTMLTextAreaElement*&gt;(this)-&gt;setFormControlValueMatchesRenderer(true);
</span><span class="cx">     m_isDirty = true;
</span><span class="cx">     m_wasModifiedByUser = true;
</span><del>-    const_cast&lt;HTMLTextAreaElement*&gt;(this)-&gt;updatePlaceholderVisibility(false);
</del><ins>+    const_cast&lt;HTMLTextAreaElement*&gt;(this)-&gt;updatePlaceholderVisibility();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String HTMLTextAreaElement::value() const
</span><span class="lines">@@ -385,7 +385,7 @@
</span><span class="cx">     m_value = normalizedValue;
</span><span class="cx">     setInnerTextValue(m_value);
</span><span class="cx">     setLastChangeWasNotUserEdit();
</span><del>-    updatePlaceholderVisibility(false);
</del><ins>+    updatePlaceholderVisibility();
</ins><span class="cx">     setNeedsStyleRecalc();
</span><span class="cx">     setFormControlValueMatchesRenderer(true);
</span><span class="cx"> 
</span><span class="lines">@@ -539,6 +539,7 @@
</span><span class="cx">         RefPtr&lt;HTMLDivElement&gt; placeholder = HTMLDivElement::create(document());
</span><span class="cx">         m_placeholder = placeholder.get();
</span><span class="cx">         m_placeholder-&gt;setPseudo(AtomicString(&quot;-webkit-input-placeholder&quot;, AtomicString::ConstructFromLiteral));
</span><ins>+        m_placeholder-&gt;setInlineStyleProperty(CSSPropertyDisplay, isPlaceholderVisible() ? CSSValueBlock : CSSValueNone, true);
</ins><span class="cx">         userAgentShadowRoot()-&gt;insertBefore(m_placeholder, innerTextElement()-&gt;nextSibling());
</span><span class="cx">     }
</span><span class="cx">     m_placeholder-&gt;setInnerText(placeholderText, ASSERT_NO_EXCEPTION);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTextFormControlElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx">  * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
</span><span class="cx">  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
</span><span class="cx">  *           (C) 2001 Dirk Mueller (mueller@kde.org)
</span><del>- * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2004, 2005, 2006, 2007, 2014 Apple Inc. All rights reserved.
</ins><span class="cx">  *           (C) 2006 Alexey Proskuryakov (ap@nypop.com)
</span><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> #include &quot;HTMLInputElement.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;NodeTraversal.h&quot;
</span><ins>+#include &quot;Page.h&quot;
</ins><span class="cx"> #include &quot;RenderBlockFlow.h&quot;
</span><span class="cx"> #include &quot;RenderTextControlSingleLine.h&quot;
</span><span class="cx"> #include &quot;RenderTheme.h&quot;
</span><span class="lines">@@ -55,10 +56,11 @@
</span><span class="cx"> 
</span><span class="cx"> HTMLTextFormControlElement::HTMLTextFormControlElement(const QualifiedName&amp; tagName, Document&amp; document, HTMLFormElement* form)
</span><span class="cx">     : HTMLFormControlElementWithState(tagName, document, form)
</span><del>-    , m_lastChangeWasUserEdit(false)
</del><span class="cx">     , m_cachedSelectionStart(-1)
</span><span class="cx">     , m_cachedSelectionEnd(-1)
</span><span class="cx">     , m_cachedSelectionDirection(SelectionHasNoDirection)
</span><ins>+    , m_lastChangeWasUserEdit(false)
+    , m_isPlaceholderVisible(false)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -88,7 +90,7 @@
</span><span class="cx"> void HTMLTextFormControlElement::dispatchFocusEvent(PassRefPtr&lt;Element&gt; oldFocusedElement, FocusDirection direction)
</span><span class="cx"> {
</span><span class="cx">     if (supportsPlaceholder())
</span><del>-        updatePlaceholderVisibility(false);
</del><ins>+        updatePlaceholderVisibility();
</ins><span class="cx">     handleFocusEvent(oldFocusedElement.get(), direction);
</span><span class="cx">     HTMLFormControlElementWithState::dispatchFocusEvent(oldFocusedElement, direction);
</span><span class="cx"> }
</span><span class="lines">@@ -96,7 +98,7 @@
</span><span class="cx"> void HTMLTextFormControlElement::dispatchBlurEvent(PassRefPtr&lt;Element&gt; newFocusedElement)
</span><span class="cx"> {
</span><span class="cx">     if (supportsPlaceholder())
</span><del>-        updatePlaceholderVisibility(false);
</del><ins>+        updatePlaceholderVisibility();
</ins><span class="cx">     handleBlurEvent();
</span><span class="cx">     HTMLFormControlElementWithState::dispatchBlurEvent(newFocusedElement);
</span><span class="cx"> }
</span><span class="lines">@@ -147,23 +149,26 @@
</span><span class="cx"> 
</span><span class="cx"> bool HTMLTextFormControlElement::placeholderShouldBeVisible() const
</span><span class="cx"> {
</span><ins>+    // This function is used by the style resolver to match the :placeholder-shown pseudo class.
+    // Since it is used for styling, it must not use any value depending on the style.
</ins><span class="cx">     return supportsPlaceholder()
</span><span class="cx">         &amp;&amp; isEmptyValue()
</span><span class="cx">         &amp;&amp; !isPlaceholderEmpty()
</span><del>-        &amp;&amp; (document().focusedElement() != this || (renderer() &amp;&amp; renderer()-&gt;theme().shouldShowPlaceholderWhenFocused()))
-        &amp;&amp; (!renderer() || renderer()-&gt;style().visibility() == VISIBLE);
</del><ins>+        &amp;&amp; (document().focusedElement() != this || (document().page()-&gt;theme().shouldShowPlaceholderWhenFocused()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void HTMLTextFormControlElement::updatePlaceholderVisibility(bool placeholderValueChanged)
</del><ins>+void HTMLTextFormControlElement::updatePlaceholderVisibility()
</ins><span class="cx"> {
</span><del>-    if (!supportsPlaceholder())
</del><ins>+    bool placeHolderWasVisible = m_isPlaceholderVisible;
+    m_isPlaceholderVisible = placeholderShouldBeVisible();
+
+    if (placeHolderWasVisible == m_isPlaceholderVisible)
</ins><span class="cx">         return;
</span><del>-    if (!placeholderElement() || placeholderValueChanged)
-        updatePlaceholderText();
-    HTMLElement* placeholder = placeholderElement();
-    if (!placeholder)
-        return;
-    placeholder-&gt;setInlineStyleProperty(CSSPropertyVisibility, placeholderShouldBeVisible() ? CSSValueVisible : CSSValueHidden);
</del><ins>+
+    setNeedsStyleRecalc();
+
+    if (HTMLElement* placeholder = placeholderElement())
+        placeholder-&gt;setInlineStyleProperty(CSSPropertyDisplay, m_isPlaceholderVisible ? CSSValueBlock : CSSValueNone, true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLTextFormControlElement::setSelectionStart(int start)
</span><span class="lines">@@ -396,7 +401,7 @@
</span><span class="cx">     if (!isTextFormControl())
</span><span class="cx">         return directionString(SelectionHasNoDirection);
</span><span class="cx">     if (document().focusedElement() != this &amp;&amp; hasCachedSelection())
</span><del>-        return directionString(m_cachedSelectionDirection);
</del><ins>+        return directionString(cachedSelectionDirection());
</ins><span class="cx"> 
</span><span class="cx">     return directionString(computeSelectionDirection());
</span><span class="cx"> }
</span><span class="lines">@@ -466,7 +471,7 @@
</span><span class="cx"> 
</span><span class="cx"> void HTMLTextFormControlElement::restoreCachedSelection()
</span><span class="cx"> {
</span><del>-    setSelectionRange(m_cachedSelectionStart, m_cachedSelectionEnd, m_cachedSelectionDirection);
</del><ins>+    setSelectionRange(m_cachedSelectionStart, m_cachedSelectionEnd, cachedSelectionDirection());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLTextFormControlElement::selectionChanged(bool shouldFireSelectEvent)
</span><span class="lines">@@ -484,9 +489,10 @@
</span><span class="cx"> 
</span><span class="cx"> void HTMLTextFormControlElement::parseAttribute(const QualifiedName&amp; name, const AtomicString&amp; value)
</span><span class="cx"> {
</span><del>-    if (name == placeholderAttr)
-        updatePlaceholderVisibility(true);
-    else
</del><ins>+    if (name == placeholderAttr) {
+        updatePlaceholderText();
+        updatePlaceholderVisibility();
+    } else
</ins><span class="cx">         HTMLFormControlElementWithState::parseAttribute(name, value);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -626,19 +632,14 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> void HTMLTextFormControlElement::hidePlaceholder()
</span><span class="cx"> {
</span><del>-    if (!supportsPlaceholder())
-        return;
-    HTMLElement* placeholder = placeholderElement();
-    if (!placeholder) {
-        updatePlaceholderText();
-        return;
-    }
-    placeholder-&gt;setInlineStyleProperty(CSSPropertyVisibility, ASCIILiteral(&quot;hidden&quot;));
</del><ins>+    if (HTMLElement* placeholder = placeholderElement())
+        placeholder-&gt;setInlineStyleProperty(CSSPropertyVisibility, CSSValueHidden, true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLTextFormControlElement::showPlaceholderIfNecessary()
</span><span class="cx"> {
</span><del>-    updatePlaceholderVisibility(false);
</del><ins>+    if (HTMLElement* placeholder = placeholderElement())
+        placeholder-&gt;setInlineStyleProperty(CSSPropertyVisibility, CSSValueVisible, true);
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTextFormControlElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTextFormControlElement.h (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTextFormControlElement.h        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/Source/WebCore/html/HTMLTextFormControlElement.h        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx">  * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
</span><span class="cx">  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
</span><span class="cx">  *           (C) 2000 Dirk Mueller (mueller@kde.org)
</span><del>- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2014 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved.
</span><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="lines">@@ -50,11 +50,11 @@
</span><span class="cx">     virtual InsertionNotificationRequest insertedInto(ContainerNode&amp;) override;
</span><span class="cx"> 
</span><span class="cx">     // The derived class should return true if placeholder processing is needed.
</span><ins>+    bool isPlaceholderVisible() const { return m_isPlaceholderVisible; }
</ins><span class="cx">     virtual bool supportsPlaceholder() const = 0;
</span><span class="cx">     String strippedPlaceholder() const;
</span><del>-    bool placeholderShouldBeVisible() const;
</del><span class="cx">     virtual HTMLElement* placeholderElement() const = 0;
</span><del>-    void updatePlaceholderVisibility(bool);
</del><ins>+    void updatePlaceholderVisibility();
</ins><span class="cx"> 
</span><span class="cx">     int indexForVisiblePosition(const VisiblePosition&amp;) const;
</span><span class="cx">     VisiblePosition visiblePositionForIndex(int index) const;
</span><span class="lines">@@ -120,6 +120,8 @@
</span><span class="cx">     String valueWithHardLineBreaks() const;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><ins>+    TextFieldSelectionDirection cachedSelectionDirection() const { return static_cast&lt;TextFieldSelectionDirection&gt;(m_cachedSelectionDirection); }
+
</ins><span class="cx">     int computeSelectionStart() const;
</span><span class="cx">     int computeSelectionEnd() const;
</span><span class="cx">     TextFieldSelectionDirection computeSelectionDirection() const;
</span><span class="lines">@@ -137,12 +139,16 @@
</span><span class="cx">     // Called in dispatchBlurEvent(), after placeholder process, before calling parent's dispatchBlurEvent().
</span><span class="cx">     virtual void handleBlurEvent() { }
</span><span class="cx"> 
</span><ins>+    bool placeholderShouldBeVisible() const;
+
</ins><span class="cx">     String m_textAsOfLastFormControlChangeEvent;
</span><del>-    bool m_lastChangeWasUserEdit;
-    
</del><ins>+
</ins><span class="cx">     int m_cachedSelectionStart;
</span><span class="cx">     int m_cachedSelectionEnd;
</span><del>-    TextFieldSelectionDirection m_cachedSelectionDirection;
</del><ins>+
+    unsigned char m_cachedSelectionDirection : 2;
+    unsigned char m_lastChangeWasUserEdit : 1;
+    unsigned char m_isPlaceholderVisible : 1;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> void isHTMLTextFormControlElement(const HTMLTextFormControlElement&amp;); // Catch unnecessary runtime check of type known at compile time.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlTextFieldInputTypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/TextFieldInputType.cpp        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2010 Google Inc. All rights reserved.
</span><del>- * Copyright (C) 2011 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2011, 2014 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions are
</span><span class="lines">@@ -409,6 +409,7 @@
</span><span class="cx">     if (!m_placeholder) {
</span><span class="cx">         m_placeholder = HTMLDivElement::create(element().document());
</span><span class="cx">         m_placeholder-&gt;setPseudo(AtomicString(&quot;-webkit-input-placeholder&quot;, AtomicString::ConstructFromLiteral));
</span><ins>+        m_placeholder-&gt;setInlineStyleProperty(CSSPropertyDisplay, element().isPlaceholderVisible() ? CSSValueBlock : CSSValueNone, true);
</ins><span class="cx">         element().userAgentShadowRoot()-&gt;insertBefore(m_placeholder, m_container ? m_container.get() : innerTextElement(), ASSERT_NO_EXCEPTION);
</span><span class="cx">     }
</span><span class="cx">     m_placeholder-&gt;setInnerText(placeholderText, ASSERT_NO_EXCEPTION);
</span><span class="lines">@@ -438,7 +439,7 @@
</span><span class="cx">     // sanitizeUserInputValue().
</span><span class="cx">     // sanitizeValue() is needed because IME input doesn't dispatch BeforeTextInsertedEvent.
</span><span class="cx">     element().setValueFromRenderer(sanitizeValue(convertFromVisibleValue(element().innerTextValue())));
</span><del>-    element().updatePlaceholderVisibility(false);
</del><ins>+    element().updatePlaceholderVisibility();
</ins><span class="cx">     // Recalc for :invalid change.
</span><span class="cx">     element().setNeedsStyleRecalc();
</span><span class="cx"> 
</span><span class="lines">@@ -472,7 +473,7 @@
</span><span class="cx">         // Update the renderer value if the formControlValueMatchesRenderer() flag is false.
</span><span class="cx">         // It protects an unacceptable renderer value from being overwritten with the DOM value.
</span><span class="cx">         element().setInnerTextValue(visibleValue());
</span><del>-        element().updatePlaceholderVisibility(false);
</del><ins>+        element().updatePlaceholderVisibility();
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTextControlcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTextControl.cpp (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTextControl.cpp        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/Source/WebCore/rendering/RenderTextControl.cpp        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /**
</span><del>- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2006, 2007, 2014 Apple Inc. All rights reserved.
</ins><span class="cx">  *           (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)  
</span><span class="cx">  *
</span><span class="cx">  * This library is free software; you can redistribute it and/or
</span><span class="lines">@@ -70,7 +70,7 @@
</span><span class="cx">         innerTextRenderer-&gt;style().setWidth(Length());
</span><span class="cx">         innerTextRenderer-&gt;setStyle(createInnerTextStyle(&amp;style()));
</span><span class="cx">     }
</span><del>-    textFormControlElement().updatePlaceholderVisibility(false);
</del><ins>+    textFormControlElement().updatePlaceholderVisibility();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderTextControl::adjustInnerTextStyle(const RenderStyle* startStyle, RenderStyle* textBlockStyle) const
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/Source/WebCore/testing/Internals.cpp        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  * Copyright (C) 2012 Google Inc. All rights reserved.
</span><del>- * Copyright (C) 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -617,8 +617,11 @@
</span><span class="cx"> String Internals::visiblePlaceholder(Element* element)
</span><span class="cx"> {
</span><span class="cx">     if (element &amp;&amp; isHTMLTextFormControlElement(*element)) {
</span><del>-        if (toHTMLTextFormControlElement(*element).placeholderShouldBeVisible())
-            return toHTMLTextFormControlElement(*element).placeholderElement()-&gt;textContent();
</del><ins>+        const HTMLTextFormControlElement&amp; textFormControlElement = toHTMLTextFormControlElement(*element);
+        if (!textFormControlElement.isPlaceholderVisible())
+            return String();
+        if (HTMLElement* placeholderElement = textFormControlElement.placeholderElement())
+            return placeholderElement-&gt;textContent();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return String();
</span></span></pre></div>
<a id="trunkSourceWebKitWebKitvcxprojWebKitExportGeneratorWebKitExportsdefin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in (172825 => 172826)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in        2014-08-21 03:24:33 UTC (rev 172825)
+++ trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in        2014-08-21 03:33:18 UTC (rev 172826)
</span><span class="lines">@@ -262,7 +262,6 @@
</span><span class="cx">         symbolWithPointer(?page@Document@WebCore@@QBEPAVPage@2@XZ, ?page@Document@WebCore@@QEBAPEAVPage@2@XZ)
</span><span class="cx">         symbolWithPointer(?pageNumberForElement@PrintContext@WebCore@@SAHPAVElement@2@ABVFloatSize@2@@Z, ?pageNumberForElement@PrintContext@WebCore@@SAHPEAVElement@2@AEBVFloatSize@2@@Z)
</span><span class="cx">         symbolWithPointer(?paintControlTints@FrameView@WebCore@@AAEXXZ, ?paintControlTints@FrameView@WebCore@@AEAAXXZ)
</span><del>-        symbolWithPointer(?placeholderShouldBeVisible@HTMLTextFormControlElement@WebCore@@QBE_NXZ, ?placeholderShouldBeVisible@HTMLTextFormControlElement@WebCore@@QEBA_NXZ)
</del><span class="cx">         symbolWithPointer(?rangeFromLocationAndLength@TextIterator@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@PAVContainerNode@2@HH_N@Z, ?rangeFromLocationAndLength@TextIterator@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@PEAVContainerNode@2@HH_N@Z)
</span><span class="cx">         symbolWithPointer(?rectBasedTestResult@HitTestResult@WebCore@@QBEABV?$ListHashSet@V?$RefPtr@VNode@WebCore@@@WTF@@$0BAA@U?$PtrHash@V?$RefPtr@VNode@WebCore@@@WTF@@@2@@WTF@@XZ, ?rectBasedTestResult@HitTestResult@WebCore@@QEBAAEBV?$ListHashSet@V?$RefPtr@VNode@WebCore@@@WTF@@$0BAA@U?$PtrHash@V?$RefPtr@VNode@WebCore@@@WTF@@@2@@WTF@@XZ)
</span><span class="cx">         symbolWithPointer(?rectForPoint@HitTestLocation@WebCore@@SA?AVIntRect@2@ABVLayoutPoint@2@IIII@Z, ?rectForPoint@HitTestLocation@WebCore@@SA?AVIntRect@2@AEBVLayoutPoint@2@IIII@Z)
</span></span></pre>
</div>
</div>

</body>
</html>