<!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>[46062] 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/46062">46062</a></dd>
<dt>Author</dt> <dd>pkasting@chromium.org</dd>
<dt>Date</dt> <dd>2009-07-17 15:37:41 -0700 (Fri, 17 Jul 2009)</dd>
</dl>

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

2009-07-17  Michelangelo De Simone  &lt;micdesim@gmail.com&gt;

        Reviewed by Darin Adler.

        https://bugs.webkit.org/show_bug.cgi?id=25551
        Test suite for the required attribute, the valueMissing flag and new
        :required and :optional CSS pseudoclasses.
        Part of the HTML5 sec. Forms.
        http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#attr-input-required

        * fast/css/pseudo-required-optional-001-expected.txt: Added.
        * fast/css/pseudo-required-optional-001.html: Added.
        * fast/css/pseudo-required-optional-002-expected.txt: Added.
        * fast/css/pseudo-required-optional-002.html: Added.
        * fast/css/pseudo-required-optional-003-expected.txt: Added.
        * fast/css/pseudo-required-optional-003.html: Added.
        * fast/css/pseudo-required-optional-004-expected.txt: Added.
        * fast/css/pseudo-required-optional-004.html: Added.
        * fast/css/pseudo-required-optional-005-expected.txt: Added.
        * fast/css/pseudo-required-optional-005.html: Added.
        * fast/css/pseudo-required-optional-006-expected.txt: Added.
        * fast/css/pseudo-required-optional-006.html: Added.
        * fast/forms/ValidityState-valueMissing-001-expected.txt: Added.
        * fast/forms/ValidityState-valueMissing-001.html: Added.
        * fast/forms/ValidityState-valueMissing-002-expected.txt: Added.
        * fast/forms/ValidityState-valueMissing-002.html: Added.
        * fast/forms/ValidityState-valueMissing-003-expected.txt: Added.
        * fast/forms/ValidityState-valueMissing-003.html: Added.
        * fast/forms/ValidityState-valueMissing-004-expected.txt: Added.
        * fast/forms/ValidityState-valueMissing-004.html: Added.
        * fast/forms/ValidityState-valueMissing-005-expected.txt: Added.
        * fast/forms/ValidityState-valueMissing-005.html: Added.
        * fast/forms/ValidityState-valueMissing-006-expected.txt: Added.
        * fast/forms/ValidityState-valueMissing-006.html: Added.
        * fast/forms/ValidityState-valueMissing-007-expected.txt: Added.
        * fast/forms/ValidityState-valueMissing-007.html: Added.
        * fast/forms/ValidityState-valueMissing-008-expected.txt: Added.
        * fast/forms/ValidityState-valueMissing-008.html: Added.
        * fast/forms/ValidityState-valueMissing-009-expected.txt: Added.
        * fast/forms/ValidityState-valueMissing-009.html: Added.
        * fast/forms/required-attribute-001-expected.txt: Added.
        * fast/forms/required-attribute-001.html: Added.
        * fast/forms/required-attribute-002-expected.txt: Added.
        * fast/forms/required-attribute-002.html: Added.

WebCore:

2009-07-17  Michelangelo De Simone  &lt;micdesim@gmail.com&gt;

        Reviewed by Darin Adler.

        https://bugs.webkit.org/show_bug.cgi?id=25551
        Added support for the &quot;required&quot; attribute, the valueMissing flag
        to the ValidityState object and :required/:optional CSS pseudoclasses.
        Part of HTML5 sec. Forms specs.
        http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#attr-input-required

        Tests: fast/css/pseudo-required-optional-001.html
               fast/css/pseudo-required-optional-002.html
               fast/css/pseudo-required-optional-003.html
               fast/css/pseudo-required-optional-004.html
               fast/css/pseudo-required-optional-005.html
               fast/css/pseudo-required-optional-006.html
               fast/forms/ValidityState-valueMissing-001.html
               fast/forms/ValidityState-valueMissing-002.html
               fast/forms/ValidityState-valueMissing-003.html
               fast/forms/ValidityState-valueMissing-004.html
               fast/forms/ValidityState-valueMissing-005.html
               fast/forms/ValidityState-valueMissing-006.html
               fast/forms/ValidityState-valueMissing-007.html
               fast/forms/ValidityState-valueMissing-008.html
               fast/forms/ValidityState-valueMissing-009.html
               fast/forms/required-attribute-001.html
               fast/forms/required-attribute-002.html

        * css/CSSSelector.cpp:
        (WebCore::CSSSelector::extractPseudoType): pseudoRequired/pseudoOptional
        * css/CSSSelector.h:
        (WebCore::CSSSelector::): ditto
        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): ditto
        * dom/Element.h:
        (WebCore::Element::isOptionalFormControl): check for optional controls
        (WebCore::Element::isRequiredFormControl): check for required controls
        * html/HTMLAttributeNames.in: required attribute
        * html/HTMLButtonElement.h:
        (WebCore::HTMLButtonElement::isOptionalFormControl): ditto
        * html/HTMLFormControlElement.cpp:
        (WebCore::HTMLFormControlElement::required): requiredAttr getter
        (WebCore::HTMLFormControlElement::setRequired): requiredAttr setter
        * html/HTMLFormControlElement.h:
        (WebCore::HTMLFormControlElement::valueMissing): method definition
        * html/HTMLInputElement.cpp:
        (WebCore::HTMLInputElement::valueMissing): validation code
        (WebCore::HTMLInputElement::isRequiredFormControl): ditto
        * html/HTMLInputElement.h:
        (WebCore::HTMLInputElement::isOptionalFormControl): ditto
        * html/HTMLInputElement.idl: required DOM attribute
        * html/HTMLSelectElement.h:
        (WebCore::HTMLSelectElement::isOptionalFormControl): ditto
        * html/HTMLTextAreaElement.h:
        (WebCore::HTMLTextAreaElement::valueMissing): validation code
        (WebCore::HTMLTextAreaElement::isOptionalFormControl): ditto
        (WebCore::HTMLTextAreaElement::isRequiredFormControl): ditto
        * html/HTMLTextAreaElement.idl: required DOM attribute
        * html/ValidityState.cpp:
        * html/ValidityState.h:
        (WebCore::ValidityState::valueMissing): validation flag</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCorecssCSSSelectorcpp">trunk/WebCore/css/CSSSelector.cpp</a></li>
<li><a href="#trunkWebCorecssCSSSelectorh">trunk/WebCore/css/CSSSelector.h</a></li>
<li><a href="#trunkWebCorecssCSSStyleSelectorcpp">trunk/WebCore/css/CSSStyleSelector.cpp</a></li>
<li><a href="#trunkWebCoredomElementh">trunk/WebCore/dom/Element.h</a></li>
<li><a href="#trunkWebCorehtmlHTMLAttributeNamesin">trunk/WebCore/html/HTMLAttributeNames.in</a></li>
<li><a href="#trunkWebCorehtmlHTMLButtonElementh">trunk/WebCore/html/HTMLButtonElement.h</a></li>
<li><a href="#trunkWebCorehtmlHTMLFormControlElementcpp">trunk/WebCore/html/HTMLFormControlElement.cpp</a></li>
<li><a href="#trunkWebCorehtmlHTMLFormControlElementh">trunk/WebCore/html/HTMLFormControlElement.h</a></li>
<li><a href="#trunkWebCorehtmlHTMLInputElementcpp">trunk/WebCore/html/HTMLInputElement.cpp</a></li>
<li><a href="#trunkWebCorehtmlHTMLInputElementh">trunk/WebCore/html/HTMLInputElement.h</a></li>
<li><a href="#trunkWebCorehtmlHTMLInputElementidl">trunk/WebCore/html/HTMLInputElement.idl</a></li>
<li><a href="#trunkWebCorehtmlHTMLSelectElementh">trunk/WebCore/html/HTMLSelectElement.h</a></li>
<li><a href="#trunkWebCorehtmlHTMLTextAreaElementh">trunk/WebCore/html/HTMLTextAreaElement.h</a></li>
<li><a href="#trunkWebCorehtmlHTMLTextAreaElementidl">trunk/WebCore/html/HTMLTextAreaElement.idl</a></li>
<li><a href="#trunkWebCorehtmlValidityStatecpp">trunk/WebCore/html/ValidityState.cpp</a></li>
<li><a href="#trunkWebCorehtmlValidityStateh">trunk/WebCore/html/ValidityState.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastcsspseudorequiredoptional001expectedtxt">trunk/LayoutTests/fast/css/pseudo-required-optional-001-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcsspseudorequiredoptional001html">trunk/LayoutTests/fast/css/pseudo-required-optional-001.html</a></li>
<li><a href="#trunkLayoutTestsfastcsspseudorequiredoptional002expectedtxt">trunk/LayoutTests/fast/css/pseudo-required-optional-002-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcsspseudorequiredoptional002html">trunk/LayoutTests/fast/css/pseudo-required-optional-002.html</a></li>
<li><a href="#trunkLayoutTestsfastcsspseudorequiredoptional003expectedtxt">trunk/LayoutTests/fast/css/pseudo-required-optional-003-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcsspseudorequiredoptional003html">trunk/LayoutTests/fast/css/pseudo-required-optional-003.html</a></li>
<li><a href="#trunkLayoutTestsfastcsspseudorequiredoptional004expectedtxt">trunk/LayoutTests/fast/css/pseudo-required-optional-004-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcsspseudorequiredoptional004html">trunk/LayoutTests/fast/css/pseudo-required-optional-004.html</a></li>
<li><a href="#trunkLayoutTestsfastcsspseudorequiredoptional005expectedtxt">trunk/LayoutTests/fast/css/pseudo-required-optional-005-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcsspseudorequiredoptional005html">trunk/LayoutTests/fast/css/pseudo-required-optional-005.html</a></li>
<li><a href="#trunkLayoutTestsfastcsspseudorequiredoptional006expectedtxt">trunk/LayoutTests/fast/css/pseudo-required-optional-006-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcsspseudorequiredoptional006html">trunk/LayoutTests/fast/css/pseudo-required-optional-006.html</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatevalueMissing001expectedtxt">trunk/LayoutTests/fast/forms/ValidityState-valueMissing-001-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatevalueMissing001html">trunk/LayoutTests/fast/forms/ValidityState-valueMissing-001.html</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatevalueMissing002expectedtxt">trunk/LayoutTests/fast/forms/ValidityState-valueMissing-002-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatevalueMissing002html">trunk/LayoutTests/fast/forms/ValidityState-valueMissing-002.html</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatevalueMissing003expectedtxt">trunk/LayoutTests/fast/forms/ValidityState-valueMissing-003-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatevalueMissing003html">trunk/LayoutTests/fast/forms/ValidityState-valueMissing-003.html</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatevalueMissing004expectedtxt">trunk/LayoutTests/fast/forms/ValidityState-valueMissing-004-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatevalueMissing004html">trunk/LayoutTests/fast/forms/ValidityState-valueMissing-004.html</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatevalueMissing005expectedtxt">trunk/LayoutTests/fast/forms/ValidityState-valueMissing-005-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatevalueMissing005html">trunk/LayoutTests/fast/forms/ValidityState-valueMissing-005.html</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatevalueMissing006expectedtxt">trunk/LayoutTests/fast/forms/ValidityState-valueMissing-006-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatevalueMissing006html">trunk/LayoutTests/fast/forms/ValidityState-valueMissing-006.html</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatevalueMissing007expectedtxt">trunk/LayoutTests/fast/forms/ValidityState-valueMissing-007-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatevalueMissing007html">trunk/LayoutTests/fast/forms/ValidityState-valueMissing-007.html</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatevalueMissing008expectedtxt">trunk/LayoutTests/fast/forms/ValidityState-valueMissing-008-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatevalueMissing008html">trunk/LayoutTests/fast/forms/ValidityState-valueMissing-008.html</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatevalueMissing009expectedtxt">trunk/LayoutTests/fast/forms/ValidityState-valueMissing-009-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatevalueMissing009html">trunk/LayoutTests/fast/forms/ValidityState-valueMissing-009.html</a></li>
<li><a href="#trunkLayoutTestsfastformsrequiredattribute001expectedtxt">trunk/LayoutTests/fast/forms/required-attribute-001-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsrequiredattribute001html">trunk/LayoutTests/fast/forms/required-attribute-001.html</a></li>
<li><a href="#trunkLayoutTestsfastformsrequiredattribute002expectedtxt">trunk/LayoutTests/fast/forms/required-attribute-002-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsrequiredattribute002html">trunk/LayoutTests/fast/forms/required-attribute-002.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (46061 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2009-07-17 22:30:41 UTC (rev 46061)
+++ trunk/LayoutTests/ChangeLog        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -1,3 +1,48 @@
</span><ins>+2009-07-17  Michelangelo De Simone  &lt;micdesim@gmail.com&gt;
+
+        Reviewed by Darin Adler.
+
+        https://bugs.webkit.org/show_bug.cgi?id=25551
+        Test suite for the required attribute, the valueMissing flag and new
+        :required and :optional CSS pseudoclasses.
+        Part of the HTML5 sec. Forms.
+        http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#attr-input-required
+
+        * fast/css/pseudo-required-optional-001-expected.txt: Added.
+        * fast/css/pseudo-required-optional-001.html: Added.
+        * fast/css/pseudo-required-optional-002-expected.txt: Added.
+        * fast/css/pseudo-required-optional-002.html: Added.
+        * fast/css/pseudo-required-optional-003-expected.txt: Added.
+        * fast/css/pseudo-required-optional-003.html: Added.
+        * fast/css/pseudo-required-optional-004-expected.txt: Added.
+        * fast/css/pseudo-required-optional-004.html: Added.
+        * fast/css/pseudo-required-optional-005-expected.txt: Added.
+        * fast/css/pseudo-required-optional-005.html: Added.
+        * fast/css/pseudo-required-optional-006-expected.txt: Added.
+        * fast/css/pseudo-required-optional-006.html: Added.
+        * fast/forms/ValidityState-valueMissing-001-expected.txt: Added.
+        * fast/forms/ValidityState-valueMissing-001.html: Added.
+        * fast/forms/ValidityState-valueMissing-002-expected.txt: Added.
+        * fast/forms/ValidityState-valueMissing-002.html: Added.
+        * fast/forms/ValidityState-valueMissing-003-expected.txt: Added.
+        * fast/forms/ValidityState-valueMissing-003.html: Added.
+        * fast/forms/ValidityState-valueMissing-004-expected.txt: Added.
+        * fast/forms/ValidityState-valueMissing-004.html: Added.
+        * fast/forms/ValidityState-valueMissing-005-expected.txt: Added.
+        * fast/forms/ValidityState-valueMissing-005.html: Added.
+        * fast/forms/ValidityState-valueMissing-006-expected.txt: Added.
+        * fast/forms/ValidityState-valueMissing-006.html: Added.
+        * fast/forms/ValidityState-valueMissing-007-expected.txt: Added.
+        * fast/forms/ValidityState-valueMissing-007.html: Added.
+        * fast/forms/ValidityState-valueMissing-008-expected.txt: Added.
+        * fast/forms/ValidityState-valueMissing-008.html: Added.
+        * fast/forms/ValidityState-valueMissing-009-expected.txt: Added.
+        * fast/forms/ValidityState-valueMissing-009.html: Added.
+        * fast/forms/required-attribute-001-expected.txt: Added.
+        * fast/forms/required-attribute-001.html: Added.
+        * fast/forms/required-attribute-002-expected.txt: Added.
+        * fast/forms/required-attribute-002.html: Added.
+
</ins><span class="cx"> 2009-07-17  Drew Wilson  &lt;atwilson@google.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by David Levin.
</span></span></pre></div>
<a id="trunkLayoutTestsfastcsspseudorequiredoptional001expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/pseudo-required-optional-001-expected.txt (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/pseudo-required-optional-001-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-required-optional-001-expected.txt        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+All controls should have a green background.
+

+SUCCESS
+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcsspseudorequiredoptional001html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/pseudo-required-optional-001.html (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/pseudo-required-optional-001.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-required-optional-001.html        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;required/optional CSS pseudoclasses&lt;/title&gt;
+&lt;style&gt;
+ input:required { background: lime; }
+ textarea:required { background: lime; }
+ input { background: red; }
+ textarea { background: red; }
+ input:optional { background: red; }
+ textarea:optional { background: red; }
+&lt;/style&gt;
+&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
+    function log(message) {
+        document.getElementById(&quot;console&quot;).innerHTML += &quot;&lt;li&gt;&quot;+message+&quot;&lt;/li&gt;&quot;;
+    }
+
+    function test() {
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+
+        v = document.getElementsByName(&quot;victim&quot;);
+
+        for (i = 0; i &lt; v.length; i++)
+            if (document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') == &quot;rgb(0, 255, 0)&quot;)
+                log(&quot;SUCCESS&quot;);
+            else
+                log(&quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;All controls should have a green background.&lt;/p&gt;
+&lt;input name=&quot;victim&quot; required /&gt;
+&lt;textarea name=&quot;victim&quot; required /&gt;&lt;/textarea&gt;
+&lt;hr&gt;
+&lt;ol id=&quot;console&quot;&gt;&lt;/ol&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcsspseudorequiredoptional002expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/pseudo-required-optional-002-expected.txt (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/pseudo-required-optional-002-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-required-optional-002-expected.txt        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+All controls should have a green background.
+

+SUCCESS
+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcsspseudorequiredoptional002html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/pseudo-required-optional-002.html (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/pseudo-required-optional-002.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-required-optional-002.html        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;required/optional CSS pseudoclasses part 2&lt;/title&gt;
+&lt;style&gt;
+ input:optional { background: lime; }
+ textarea:optional { background: lime; }
+ input { background: red; }
+ textarea { background: red; }
+&lt;/style&gt;
+&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
+    function log(message) {
+        document.getElementById(&quot;console&quot;).innerHTML += &quot;&lt;li&gt;&quot;+message+&quot;&lt;/li&gt;&quot;;
+    }
+
+    function test() {
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+
+        v = document.getElementsByName(&quot;victim&quot;);
+
+        for (i = 0; i &lt; v.length; i++)
+            if (document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') == &quot;rgb(0, 255, 0)&quot;)
+                log(&quot;SUCCESS&quot;);
+            else
+                log(&quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;All controls should have a green background.&lt;/p&gt;
+&lt;input name=&quot;victim&quot;/&gt;
+&lt;textarea name=&quot;victim&quot; /&gt;&lt;/textarea&gt;
+&lt;hr&gt;
+&lt;ol id=&quot;console&quot;&gt;&lt;/ol&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcsspseudorequiredoptional003expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/pseudo-required-optional-003-expected.txt (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/pseudo-required-optional-003-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-required-optional-003-expected.txt        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+All controls should have a green background.
+
+  
+SUCCESS
+SUCCESS
+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcsspseudorequiredoptional003html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/pseudo-required-optional-003.html (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/pseudo-required-optional-003.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-required-optional-003.html        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;required/optional CSS pseudoclasses part 3&lt;/title&gt;
+&lt;style&gt;
+ input:required { background: lime; }
+ textarea:required { background: lime; }
+ input { background: red; }
+ textarea { background: red; }
+&lt;/style&gt;
+&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
+    function log(message) {
+        document.getElementById(&quot;console&quot;).innerHTML += &quot;&lt;li&gt;&quot;+message+&quot;&lt;/li&gt;&quot;;
+    }
+
+    function test() {
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+
+        v = document.getElementsByName(&quot;victim&quot;);
+
+        for (i = 0; i &lt; v.length; i++)
+            if (document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') == &quot;rgb(0, 255, 0)&quot;)
+                log(&quot;SUCCESS&quot;);
+            else
+                log(&quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;All controls should have a green background.&lt;/p&gt;
+&lt;input name=&quot;victim&quot; required /&gt;
+&lt;textarea name=&quot;victim&quot; required disabled/&gt;&lt;/textarea&gt;
+&lt;textarea name=&quot;victim&quot; required readonly/&gt;&lt;/textarea&gt;
+&lt;hr&gt;
+&lt;ol id=&quot;console&quot;&gt;&lt;/ol&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcsspseudorequiredoptional004expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/pseudo-required-optional-004-expected.txt (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/pseudo-required-optional-004-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-required-optional-004-expected.txt        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+All controls should have a green background.
+
+Lorem ipsum    
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcsspseudorequiredoptional004html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/pseudo-required-optional-004.html (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/pseudo-required-optional-004.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-required-optional-004.html        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;required/optional CSS pseudoclasses part 4&lt;/title&gt;
+&lt;style&gt;
+ button:optional { background: lime; }
+ input:optional { background: lime; }
+ select:optional { background: lime; }
+ textarea:optional { background: lime; }
+ button { background: red; }
+ input { background: red; }
+ select { background: red; }
+ textarea { background: red; }
+ button:required { background: red; }
+ input:required { background: red; }
+ select:required { background: red; }
+ textarea:required { background: red; }
+&lt;/style&gt;
+&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
+    function log(message) {
+        document.getElementById(&quot;console&quot;).innerHTML += &quot;&lt;li&gt;&quot;+message+&quot;&lt;/li&gt;&quot;;
+    }
+
+    function test() {
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+
+        v = document.getElementsByName(&quot;victim&quot;);
+
+        for (i = 0; i &lt; v.length; i++)
+            if (document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') == &quot;rgb(0, 255, 0)&quot;)
+                log(&quot;SUCCESS&quot;);
+            else
+                log(&quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;All controls should have a green background.&lt;/p&gt;
+&lt;button type=&quot;button&quot; name=&quot;victim&quot;&gt;Lorem ipsum&lt;/button&gt;
+&lt;input name=&quot;victim&quot; disabled/&gt;
+&lt;input type=&quot;button&quot; name=&quot;victim&quot;/&gt;
+&lt;select name=&quot;victim&quot;&gt;&lt;/select&gt;
+&lt;textarea name=&quot;victim&quot;&gt;&lt;/textarea&gt;
+&lt;hr&gt;
+&lt;ol id=&quot;console&quot;&gt;&lt;/ol&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcsspseudorequiredoptional005expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/pseudo-required-optional-005-expected.txt (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/pseudo-required-optional-005-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-required-optional-005-expected.txt        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+All controls should have a green background.
+
+    
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcsspseudorequiredoptional005html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/pseudo-required-optional-005.html (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/pseudo-required-optional-005.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-required-optional-005.html        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;required/optional CSS pseudoclasses part 5&lt;/title&gt;
+&lt;style&gt;
+ input:optional { background: lime; }
+ input { background: red; }
+ input:required { background: red; }
+&lt;/style&gt;
+&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
+    function log(message) {
+        document.getElementById(&quot;console&quot;).innerHTML += &quot;&lt;li&gt;&quot;+message+&quot;&lt;/li&gt;&quot;;
+    }
+
+    function test() {
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+
+        v = document.getElementsByName(&quot;victim&quot;);
+
+        for (i = 0; i &lt; v.length; i++)
+            if (document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') == &quot;rgb(0, 255, 0)&quot;)
+                log(&quot;SUCCESS&quot;);
+            else
+                log(&quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;All controls should have a green background.&lt;/p&gt;
+&lt;input type=&quot;range&quot; name=&quot;victim&quot; required/&gt;
+&lt;input type=&quot;submit&quot; name=&quot;victim&quot; required/&gt;
+&lt;input type=&quot;image&quot; name=&quot;victim&quot; required/&gt;
+&lt;input type=&quot;reset&quot; name=&quot;victim&quot; required/&gt;
+&lt;input type=&quot;button&quot; name=&quot;victim&quot; required/&gt;
+&lt;hr&gt;
+&lt;ol id=&quot;console&quot;&gt;&lt;/ol&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcsspseudorequiredoptional006expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/pseudo-required-optional-006-expected.txt (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/pseudo-required-optional-006-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-required-optional-006-expected.txt        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+All controls should have a green background.
+
+         
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcsspseudorequiredoptional006html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/pseudo-required-optional-006.html (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/pseudo-required-optional-006.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/pseudo-required-optional-006.html        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;required/optional CSS pseudoclasses part 6&lt;/title&gt;
+&lt;style&gt;
+ input:optional { background: red; }
+ input { background: red; }
+ input:required { background: lime; }
+&lt;/style&gt;
+&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
+    function log(message) {
+        document.getElementById(&quot;console&quot;).innerHTML += &quot;&lt;li&gt;&quot;+message+&quot;&lt;/li&gt;&quot;;
+    }
+
+    function test() {
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+
+        v = document.getElementsByName(&quot;victim&quot;);
+
+        for (i = 0; i &lt; v.length; i++)
+            if (document.defaultView.getComputedStyle(v[i], null).getPropertyValue('background-color') == &quot;rgb(0, 255, 0)&quot;)
+                log(&quot;SUCCESS&quot;);
+            else
+                log(&quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;All controls should have a green background.&lt;/p&gt;
+&lt;input type=&quot;text&quot; name=&quot;victim&quot; required/&gt;
+&lt;input type=&quot;password&quot; name=&quot;victim&quot; required/&gt;
+&lt;input type=&quot;search&quot; name=&quot;victim&quot; required/&gt;
+&lt;input type=&quot;url&quot; name=&quot;victim&quot; required/&gt;
+&lt;input type=&quot;telephone&quot; name=&quot;victim&quot; required/&gt;
+&lt;input type=&quot;email&quot; name=&quot;victim&quot; required/&gt;
+&lt;input type=&quot;number&quot; name=&quot;victim&quot; required/&gt;
+&lt;input type=&quot;checkbox&quot; name=&quot;victim&quot; required/&gt;
+&lt;input type=&quot;radio&quot; name=&quot;victim&quot; required/&gt;
+&lt;input type=&quot;file&quot; name=&quot;victim&quot; required/&gt;
+
+&lt;hr&gt;
+&lt;ol id=&quot;console&quot;&gt;&lt;/ol&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatevalueMissing001expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-valueMissing-001-expected.txt (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-valueMissing-001-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-valueMissing-001-expected.txt        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+There are two form control elements below, both required and blank: validity.valueMissing should be true in both cases.
+

+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatevalueMissing001html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-valueMissing-001.html (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-valueMissing-001.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-valueMissing-001.html        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;required and basic valueMissing&lt;/title&gt;
+&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
+    function log(message) {
+        document.getElementById(&quot;console&quot;).innerHTML += &quot;&lt;li&gt;&quot;+message+&quot;&lt;/li&gt;&quot;;
+    }
+
+    function test() {
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+
+        v = document.getElementsByName(&quot;victim&quot;);
+
+        log((v[0].validity.valueMissing &amp;&amp; v[1].validity.valueMissing) ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;There are two form control elements below, both required and blank:
+validity.valueMissing should be true in both cases.&lt;/p&gt;
+&lt;input name=&quot;victim&quot; required/&gt;
+&lt;textarea name=&quot;victim&quot; required&gt;&lt;/textarea&gt;
+&lt;hr&gt;
+&lt;ol id=&quot;console&quot;&gt;&lt;/ol&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatevalueMissing002expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-valueMissing-002-expected.txt (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-valueMissing-002-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-valueMissing-002-expected.txt        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+There are two form control elements below, both required and with some value: validity.valueMissing should be false in both cases.
+

+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatevalueMissing002html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-valueMissing-002.html (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-valueMissing-002.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-valueMissing-002.html        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;required and basic valueMissing 2&lt;/title&gt;
+&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
+    function log(message) {
+        document.getElementById(&quot;console&quot;).innerHTML += &quot;&lt;li&gt;&quot;+message+&quot;&lt;/li&gt;&quot;;
+    }
+
+    function test() {
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+
+        v = document.getElementsByName(&quot;victim&quot;);
+
+        log((!v[0].validity.valueMissing &amp;&amp; !v[1].validity.valueMissing) ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;There are two form control elements below, both required and with some value:
+validity.valueMissing should be false in both cases.&lt;/p&gt;
+&lt;input name=&quot;victim&quot; value=&quot;something&quot; required/&gt;
+&lt;textarea name=&quot;victim&quot; required&gt;something&lt;/textarea&gt;
+&lt;hr&gt;
+&lt;ol id=&quot;console&quot;&gt;&lt;/ol&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatevalueMissing003expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-valueMissing-003-expected.txt (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-valueMissing-003-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-valueMissing-003-expected.txt        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+There are two disabled form control elements below, both required and with some value: validity.valueMissing should be false in both cases.
+

+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatevalueMissing003html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-valueMissing-003.html (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-valueMissing-003.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-valueMissing-003.html        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;required and valueMissing on disabled elements&lt;/title&gt;
+&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
+    function log(message) {
+        document.getElementById(&quot;console&quot;).innerHTML += &quot;&lt;li&gt;&quot;+message+&quot;&lt;/li&gt;&quot;;
+    }
+
+    function test() {
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+
+        v = document.getElementsByName(&quot;victim&quot;);
+
+        log((!v[0].validity.valueMissing &amp;&amp; !v[1].validity.valueMissing) ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;There are two disabled form control elements below, both required and with some value:
+validity.valueMissing should be false in both cases.&lt;/p&gt;
+&lt;input name=&quot;victim&quot; disabled required /&gt;
+&lt;textarea name=&quot;victim&quot; disabled required&gt;&lt;/textarea&gt;
+&lt;hr&gt;
+&lt;ol id=&quot;console&quot;&gt;&lt;/ol&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatevalueMissing004expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-valueMissing-004-expected.txt (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-valueMissing-004-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-valueMissing-004-expected.txt        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+There are two readonly form control elements below, both required and with some value: validity.valueMissing should be false in both cases.
+

+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatevalueMissing004html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-valueMissing-004.html (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-valueMissing-004.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-valueMissing-004.html        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;required and valueMissing on readonly elements&lt;/title&gt;
+&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
+    function log(message) {
+        document.getElementById(&quot;console&quot;).innerHTML += &quot;&lt;li&gt;&quot;+message+&quot;&lt;/li&gt;&quot;;
+    }
+
+    function test() {
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+
+        v = document.getElementsByName(&quot;victim&quot;);
+
+        log((!v[0].validity.valueMissing &amp;&amp; !v[1].validity.valueMissing) ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;There are two readonly form control elements below, both required and with some value:
+validity.valueMissing should be false in both cases.&lt;/p&gt;
+&lt;input name=&quot;victim&quot; readonly required /&gt;
+&lt;textarea name=&quot;victim&quot; readonly required&gt;&lt;/textarea&gt;
+&lt;hr&gt;
+&lt;ol id=&quot;console&quot;&gt;&lt;/ol&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatevalueMissing005expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-valueMissing-005-expected.txt (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-valueMissing-005-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-valueMissing-005-expected.txt        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+There's a list of form control elements below, required attribute does not apply to them: validity.valueMissing should be false.
+
+    
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatevalueMissing005html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-valueMissing-005.html (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-valueMissing-005.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-valueMissing-005.html        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;required and valueMissing on unaccepted input types&lt;/title&gt;
+&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
+    function log(message) {
+        document.getElementById(&quot;console&quot;).innerHTML += &quot;&lt;li&gt;&quot;+message+&quot;&lt;/li&gt;&quot;;
+    }
+
+    function test() {
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+
+        v = document.getElementsByName(&quot;victim&quot;);
+
+        for (i = 0; i &lt; v.length; i++)
+            log(!v[i].validity.valueMissing ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;There's a list of form control elements below, required attribute does not apply to them:
+validity.valueMissing should be false.&lt;/p&gt;
+&lt;input name=&quot;victim&quot; type=&quot;hidden&quot; required /&gt;
+&lt;input name=&quot;victim&quot; type=&quot;range&quot; required /&gt;
+&lt;input name=&quot;victim&quot; type=&quot;image&quot; required /&gt;
+&lt;input name=&quot;victim&quot; type=&quot;reset&quot; required /&gt;
+&lt;input name=&quot;victim&quot; type=&quot;button&quot; required /&gt;
+&lt;input name=&quot;victim&quot; type=&quot;submit&quot; required /&gt;
+&lt;hr&gt;
+&lt;ol id=&quot;console&quot;&gt;&lt;/ol&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatevalueMissing006expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-valueMissing-006-expected.txt (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-valueMissing-006-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-valueMissing-006-expected.txt        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+There are two checkboxes below, both are required, only one is checked.
+

+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatevalueMissing006html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-valueMissing-006.html (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-valueMissing-006.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-valueMissing-006.html        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;required and valueMissing on checkboxes&lt;/title&gt;
+&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
+    function log(message) {
+        document.getElementById(&quot;console&quot;).innerHTML += &quot;&lt;li&gt;&quot;+message+&quot;&lt;/li&gt;&quot;;
+    }
+
+    function test() {
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+
+        v = document.getElementsByName(&quot;victim&quot;);
+
+        log(!v[0].validity.valueMissing &amp;&amp; v[1].validity.valueMissing ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;There are two checkboxes below, both are required, only one is checked.&lt;/p&gt;
+&lt;input name=&quot;victim&quot; type=&quot;checkbox&quot; required checked/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;checkbox&quot; required /&gt;
+&lt;hr&gt;
+&lt;ol id=&quot;console&quot;&gt;&lt;/ol&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatevalueMissing007expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-valueMissing-007-expected.txt (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-valueMissing-007-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-valueMissing-007-expected.txt        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+There are two radio buttons below with the same name, only one is required (which means the whole group is required), the other one is checked and leads the required attribute to be satisfied: no missing value.
+

+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatevalueMissing007html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-valueMissing-007.html (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-valueMissing-007.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-valueMissing-007.html        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;required and valueMissing on radio&lt;/title&gt;
+&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
+    function log(message) {
+        document.getElementById(&quot;console&quot;).innerHTML += &quot;&lt;li&gt;&quot;+message+&quot;&lt;/li&gt;&quot;;
+    }
+
+    function test() {
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+
+        v = document.getElementsByName(&quot;victim&quot;);
+
+        log(!v[0].validity.valueMissing ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;There are two radio buttons below with the same name, only one is required (which means the whole group is required), the other one is checked and leads the required attribute to be satisfied: no missing value.&lt;/p&gt;
+&lt;input name=&quot;victim&quot; type=&quot;radio&quot; required/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;radio&quot; checked/&gt;
+&lt;hr&gt;
+&lt;ol id=&quot;console&quot;&gt;&lt;/ol&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatevalueMissing008expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-valueMissing-008-expected.txt (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-valueMissing-008-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-valueMissing-008-expected.txt        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+There's a upload control below, with no file selected: missing value.
+
+
+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatevalueMissing008html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-valueMissing-008.html (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-valueMissing-008.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-valueMissing-008.html        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;required and valueMissing on file control&lt;/title&gt;
+&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
+    function log(message) {
+        document.getElementById(&quot;console&quot;).innerHTML += &quot;&lt;li&gt;&quot;+message+&quot;&lt;/li&gt;&quot;;
+    }
+
+    function test() {
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+
+        v = document.getElementsByName(&quot;victim&quot;);
+
+        log(v[0].validity.valueMissing ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;There's a upload control below, with no file selected: missing value.&lt;/p&gt;
+&lt;input name=&quot;victim&quot; type=&quot;file&quot; required/&gt;
+&lt;hr&gt;
+&lt;ol id=&quot;console&quot;&gt;&lt;/ol&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatevalueMissing009expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-valueMissing-009-expected.txt (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-valueMissing-009-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-valueMissing-009-expected.txt        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+There's a list of form control elements below, required attribute applies to them but they're empty: validity.valueMissing should be true.
+
+      
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatevalueMissing009html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-valueMissing-009.html (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-valueMissing-009.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-valueMissing-009.html        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;required and valueMissing on new input types&lt;/title&gt;
+&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
+    function log(message) {
+        document.getElementById(&quot;console&quot;).innerHTML += &quot;&lt;li&gt;&quot;+message+&quot;&lt;/li&gt;&quot;;
+    }
+
+    function test() {
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+
+        v = document.getElementsByName(&quot;victim&quot;);
+
+        for (i = 0; i &lt; v.length; i++)
+            log(v[i].validity.valueMissing ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;There's a list of form control elements below, required attribute applies to them but they're empty:
+validity.valueMissing should be true.&lt;/p&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; required /&gt;
+&lt;input name=&quot;victim&quot; type=&quot;search&quot; required /&gt;
+&lt;input name=&quot;victim&quot; type=&quot;url&quot; required /&gt;
+&lt;input name=&quot;victim&quot; type=&quot;telephone&quot; required /&gt;
+&lt;input name=&quot;victim&quot; type=&quot;email&quot; required /&gt;
+&lt;input name=&quot;victim&quot; type=&quot;password&quot; required /&gt;
+&lt;input name=&quot;victim&quot; type=&quot;number&quot; required /&gt;
+&lt;hr&gt;
+&lt;ol id=&quot;console&quot;&gt;&lt;/ol&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsrequiredattribute001expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/required-attribute-001-expected.txt (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/required-attribute-001-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/required-attribute-001-expected.txt        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+There are two form control elements below, both required.
+

+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsrequiredattribute001html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/required-attribute-001.html (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/required-attribute-001.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/required-attribute-001.html        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;required attribute presence test&lt;/title&gt;
+&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
+    function log(message) {
+        document.getElementById(&quot;console&quot;).innerHTML += &quot;&lt;li&gt;&quot;+message+&quot;&lt;/li&gt;&quot;;
+    }
+
+    function test() {
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+
+        v = document.getElementsByName(&quot;victim&quot;);
+
+        log((v[0].required &amp;&amp; v[1].required) ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;There are two form control elements below, both required.&lt;/p&gt;
+&lt;input name=&quot;victim&quot; required /&gt;
+&lt;textarea name=&quot;victim&quot; required&gt;&lt;/textarea&gt;
+&lt;hr&gt;
+&lt;ol id=&quot;console&quot;&gt;&lt;/ol&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsrequiredattribute002expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/required-attribute-002-expected.txt (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/required-attribute-002-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/required-attribute-002-expected.txt        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+There are two form control elements below, both optional. They're set as required via required DOM attribute.
+

+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsrequiredattribute002html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/required-attribute-002.html (0 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/required-attribute-002.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/required-attribute-002.html        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;required attribute JS set&lt;/title&gt;
+&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt;
+    function log(message) {
+        document.getElementById(&quot;console&quot;).innerHTML += &quot;&lt;li&gt;&quot;+message+&quot;&lt;/li&gt;&quot;;
+    }
+
+    function test() {
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+
+        v = document.getElementsByName(&quot;victim&quot;);
+
+        if (v[0].required == false &amp;&amp; v[1].required == false) {
+            v[0].required = true;
+            v[1].required = true;
+            log ((v[0].required &amp;&amp; v[1].required) ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+        }
+        else
+            log(&quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;There are two form control elements below, both optional. They're set as required via required DOM attribute.&lt;/p&gt;
+&lt;input name=&quot;victim&quot; /&gt;
+&lt;textarea name=&quot;victim&quot;&gt;&lt;/textarea&gt;
+&lt;hr&gt;
+&lt;ol id=&quot;console&quot;&gt;&lt;/ol&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (46061 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2009-07-17 22:30:41 UTC (rev 46061)
+++ trunk/WebCore/ChangeLog        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -1,3 +1,65 @@
</span><ins>+2009-07-17  Michelangelo De Simone  &lt;micdesim@gmail.com&gt;
+
+        Reviewed by Darin Adler.
+
+        https://bugs.webkit.org/show_bug.cgi?id=25551
+        Added support for the &quot;required&quot; attribute, the valueMissing flag
+        to the ValidityState object and :required/:optional CSS pseudoclasses.
+        Part of HTML5 sec. Forms specs.
+        http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#attr-input-required
+
+        Tests: fast/css/pseudo-required-optional-001.html
+               fast/css/pseudo-required-optional-002.html
+               fast/css/pseudo-required-optional-003.html
+               fast/css/pseudo-required-optional-004.html
+               fast/css/pseudo-required-optional-005.html
+               fast/css/pseudo-required-optional-006.html
+               fast/forms/ValidityState-valueMissing-001.html
+               fast/forms/ValidityState-valueMissing-002.html
+               fast/forms/ValidityState-valueMissing-003.html
+               fast/forms/ValidityState-valueMissing-004.html
+               fast/forms/ValidityState-valueMissing-005.html
+               fast/forms/ValidityState-valueMissing-006.html
+               fast/forms/ValidityState-valueMissing-007.html
+               fast/forms/ValidityState-valueMissing-008.html
+               fast/forms/ValidityState-valueMissing-009.html
+               fast/forms/required-attribute-001.html
+               fast/forms/required-attribute-002.html
+
+        * css/CSSSelector.cpp:
+        (WebCore::CSSSelector::extractPseudoType): pseudoRequired/pseudoOptional
+        * css/CSSSelector.h:
+        (WebCore::CSSSelector::): ditto
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): ditto
+        * dom/Element.h:
+        (WebCore::Element::isOptionalFormControl): check for optional controls
+        (WebCore::Element::isRequiredFormControl): check for required controls
+        * html/HTMLAttributeNames.in: required attribute
+        * html/HTMLButtonElement.h:
+        (WebCore::HTMLButtonElement::isOptionalFormControl): ditto
+        * html/HTMLFormControlElement.cpp:
+        (WebCore::HTMLFormControlElement::required): requiredAttr getter
+        (WebCore::HTMLFormControlElement::setRequired): requiredAttr setter
+        * html/HTMLFormControlElement.h:
+        (WebCore::HTMLFormControlElement::valueMissing): method definition
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::valueMissing): validation code
+        (WebCore::HTMLInputElement::isRequiredFormControl): ditto
+        * html/HTMLInputElement.h:
+        (WebCore::HTMLInputElement::isOptionalFormControl): ditto
+        * html/HTMLInputElement.idl: required DOM attribute
+        * html/HTMLSelectElement.h:
+        (WebCore::HTMLSelectElement::isOptionalFormControl): ditto
+        * html/HTMLTextAreaElement.h:
+        (WebCore::HTMLTextAreaElement::valueMissing): validation code
+        (WebCore::HTMLTextAreaElement::isOptionalFormControl): ditto
+        (WebCore::HTMLTextAreaElement::isRequiredFormControl): ditto
+        * html/HTMLTextAreaElement.idl: required DOM attribute
+        * html/ValidityState.cpp:
+        * html/ValidityState.h:
+        (WebCore::ValidityState::valueMissing): validation flag
+
</ins><span class="cx"> 2009-07-17  Beth Dakin  &lt;bdakin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Darin Adler.
</span></span></pre></div>
<a id="trunkWebCorecssCSSSelectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/css/CSSSelector.cpp (46061 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/css/CSSSelector.cpp        2009-07-17 22:30:41 UTC (rev 46061)
+++ trunk/WebCore/css/CSSSelector.cpp        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -117,6 +117,8 @@
</span><span class="cx">     DEFINE_STATIC_LOCAL(AtomicString, notStr, (&quot;not(&quot;));
</span><span class="cx">     DEFINE_STATIC_LOCAL(AtomicString, onlyChild, (&quot;only-child&quot;));
</span><span class="cx">     DEFINE_STATIC_LOCAL(AtomicString, onlyOfType, (&quot;only-of-type&quot;));
</span><ins>+    DEFINE_STATIC_LOCAL(AtomicString, optional, (&quot;optional&quot;));
+    DEFINE_STATIC_LOCAL(AtomicString, required, (&quot;required&quot;));
</ins><span class="cx">     DEFINE_STATIC_LOCAL(AtomicString, resizer, (&quot;-webkit-resizer&quot;));
</span><span class="cx">     DEFINE_STATIC_LOCAL(AtomicString, root, (&quot;root&quot;));
</span><span class="cx">     DEFINE_STATIC_LOCAL(AtomicString, scrollbar, (&quot;-webkit-scrollbar&quot;));
</span><span class="lines">@@ -286,6 +288,10 @@
</span><span class="cx">         m_pseudoType = PseudoSingleButton;
</span><span class="cx">     else if (m_value == noButton)
</span><span class="cx">         m_pseudoType = PseudoNoButton;
</span><ins>+    else if (m_value == optional)
+        m_pseudoType = PseudoOptional;
+    else if (m_value == required)
+        m_pseudoType = PseudoRequired;
</ins><span class="cx">     else if (m_value == scrollbarCorner) {
</span><span class="cx">         element = true;
</span><span class="cx">         m_pseudoType = PseudoScrollbarCorner;
</span></span></pre></div>
<a id="trunkWebCorecssCSSSelectorh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/css/CSSSelector.h (46061 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/css/CSSSelector.h        2009-07-17 22:30:41 UTC (rev 46061)
+++ trunk/WebCore/css/CSSSelector.h        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -128,6 +128,8 @@
</span><span class="cx">             PseudoFullPageMedia,
</span><span class="cx">             PseudoDisabled,
</span><span class="cx">             PseudoInputPlaceholder,
</span><ins>+            PseudoOptional,
+            PseudoRequired,
</ins><span class="cx">             PseudoReadOnly,
</span><span class="cx">             PseudoReadWrite,
</span><span class="cx">             PseudoIndeterminate,
</span></span></pre></div>
<a id="trunkWebCorecssCSSStyleSelectorcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/css/CSSStyleSelector.cpp (46061 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/css/CSSStyleSelector.cpp        2009-07-17 22:30:41 UTC (rev 46061)
+++ trunk/WebCore/css/CSSStyleSelector.cpp        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -2375,6 +2375,10 @@
</span><span class="cx">                     return false;
</span><span class="cx">                 return e-&gt;isTextFormControl() &amp;&amp; !e-&gt;isReadOnlyFormControl();
</span><span class="cx">             }
</span><ins>+            case CSSSelector::PseudoOptional:
+                return e &amp;&amp; e-&gt;isOptionalFormControl();
+            case CSSSelector::PseudoRequired:
+                return e &amp;&amp; e-&gt;isRequiredFormControl();
</ins><span class="cx">             case CSSSelector::PseudoChecked: {
</span><span class="cx">                 if (!e || !e-&gt;isFormControlElement())
</span><span class="cx">                     break;
</span></span></pre></div>
<a id="trunkWebCoredomElementh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/dom/Element.h (46061 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/dom/Element.h        2009-07-17 22:30:41 UTC (rev 46061)
+++ trunk/WebCore/dom/Element.h        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -212,6 +212,8 @@
</span><span class="cx">     virtual bool isEnabledFormControl() const { return true; }
</span><span class="cx">     virtual bool isReadOnlyFormControl() const { return false; }
</span><span class="cx">     virtual bool isTextFormControl() const { return false; }
</span><ins>+    virtual bool isOptionalFormControl() const { return false; }
+    virtual bool isRequiredFormControl() const { return false; }
</ins><span class="cx"> 
</span><span class="cx">     virtual bool formControlValueMatchesRenderer() const { return false; }
</span><span class="cx">     virtual void setFormControlValueMatchesRenderer(bool) { }
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLAttributeNamesin"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLAttributeNames.in (46061 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLAttributeNames.in        2009-07-17 22:30:41 UTC (rev 46061)
+++ trunk/WebCore/html/HTMLAttributeNames.in        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -195,6 +195,7 @@
</span><span class="cx"> prompt
</span><span class="cx"> readonly
</span><span class="cx"> rel
</span><ins>+required
</ins><span class="cx"> results
</span><span class="cx"> rev
</span><span class="cx"> role
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLButtonElementh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLButtonElement.h (46061 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLButtonElement.h        2009-07-17 22:30:41 UTC (rev 46061)
+++ trunk/WebCore/html/HTMLButtonElement.h        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -61,6 +61,7 @@
</span><span class="cx">     
</span><span class="cx"> private:
</span><span class="cx">     enum Type { SUBMIT, RESET, BUTTON };
</span><ins>+    virtual bool isOptionalFormControl() const { return true; }
</ins><span class="cx"> 
</span><span class="cx">     Type m_type;
</span><span class="cx">     bool m_activeSubmit;
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLFormControlElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLFormControlElement.cpp (46061 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLFormControlElement.cpp        2009-07-17 22:30:41 UTC (rev 46061)
+++ trunk/WebCore/html/HTMLFormControlElement.cpp        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -204,6 +204,16 @@
</span><span class="cx">     setAttribute(autofocusAttr, b ? &quot;autofocus&quot; : 0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool HTMLFormControlElement::required() const
+{
+    return hasAttribute(requiredAttr);
+}
+
+void HTMLFormControlElement::setRequired(bool b)
+{
+    setAttribute(requiredAttr, b ? &quot;required&quot; : 0);
+}
+
</ins><span class="cx"> void HTMLFormControlElement::recalcStyle(StyleChange change)
</span><span class="cx"> {
</span><span class="cx">     HTMLElement::recalcStyle(change);
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLFormControlElementh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLFormControlElement.h (46061 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLFormControlElement.h        2009-07-17 22:30:41 UTC (rev 46061)
+++ trunk/WebCore/html/HTMLFormControlElement.h        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -74,6 +74,11 @@
</span><span class="cx">     virtual bool autofocus() const;
</span><span class="cx">     void setAutofocus(bool);
</span><span class="cx"> 
</span><ins>+    bool required() const;
+    void setRequired(bool);
+
+    virtual bool valueMissing() const { return false; }
+
</ins><span class="cx">     virtual void recalcStyle(StyleChange);
</span><span class="cx"> 
</span><span class="cx">     virtual const AtomicString&amp; formControlName() const;
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLInputElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLInputElement.cpp (46061 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLInputElement.cpp        2009-07-17 22:30:41 UTC (rev 46061)
+++ trunk/WebCore/html/HTMLInputElement.cpp        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -114,6 +114,39 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool HTMLInputElement::valueMissing() const
+{
+    if (!isRequiredFormControl() || readOnly() || disabled())
+        return false;
+
+    switch (inputType()) {
+        case TEXT:
+        case SEARCH:
+        case URL:
+        case TELEPHONE:
+        case EMAIL:
+        case PASSWORD:
+        case NUMBER:
+        case FILE:
+            return value().isEmpty();
+        case CHECKBOX:
+            return !checked();
+        case RADIO:
+            return !document()-&gt;checkedRadioButtons().checkedButtonForGroup(name());
+        case HIDDEN:
+        case RANGE:
+        case SUBMIT:
+        case IMAGE:
+        case RESET:
+        case BUTTON:
+        case ISINDEX:
+            break;
+    }
+
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
</ins><span class="cx"> static inline CheckedRadioButtons&amp; checkedRadioButtons(const HTMLInputElement *element)
</span><span class="cx"> {
</span><span class="cx">     if (HTMLFormElement* form = element-&gt;form())
</span><span class="lines">@@ -1579,6 +1612,37 @@
</span><span class="cx">         document()-&gt;unregisterForDocumentActivationCallbacks(this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool HTMLInputElement::isRequiredFormControl() const
+{
+    if (!required())
+        return false;
+
+    switch (inputType()) {
+        case TEXT:
+        case SEARCH:
+        case URL:
+        case TELEPHONE:
+        case EMAIL:
+        case PASSWORD:
+        case NUMBER:
+        case CHECKBOX:
+        case RADIO:
+        case FILE:
+            return true;
+        case HIDDEN:
+        case RANGE:
+        case SUBMIT:
+        case IMAGE:
+        case RESET:
+        case BUTTON:
+        case ISINDEX:
+            return false;
+    }
+
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
</ins><span class="cx"> void HTMLInputElement::cacheSelection(int start, int end)
</span><span class="cx"> {
</span><span class="cx">     m_data.setCachedSelectionStart(start);
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLInputElementh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLInputElement.h (46061 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLInputElement.h        2009-07-17 22:30:41 UTC (rev 46061)
+++ trunk/WebCore/html/HTMLInputElement.h        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -90,6 +90,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool isTextFormControl() const { return isTextField(); }
</span><span class="cx"> 
</span><ins>+    virtual bool valueMissing() const;
+
</ins><span class="cx">     bool isTextButton() const { return m_type == SUBMIT || m_type == RESET || m_type == BUTTON; }
</span><span class="cx">     virtual bool isRadioButton() const { return m_type == RADIO; }
</span><span class="cx">     virtual bool isTextField() const { return m_type == TEXT || m_type == PASSWORD || m_type == SEARCH || m_type == ISINDEX || m_type == EMAIL || m_type == NUMBER || m_type == TELEPHONE || m_type == URL; }
</span><span class="lines">@@ -237,6 +239,9 @@
</span><span class="cx">     void registerForActivationCallbackIfNeeded();
</span><span class="cx">     void unregisterForActivationCallbackIfNeeded();
</span><span class="cx"> 
</span><ins>+    virtual bool isOptionalFormControl() const { return !isRequiredFormControl(); }
+    virtual bool isRequiredFormControl() const;
+
</ins><span class="cx">     InputElementData m_data;
</span><span class="cx">     int m_xPos;
</span><span class="cx">     int m_yPos;
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLInputElementidl"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLInputElement.idl (46061 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLInputElement.idl        2009-07-17 22:30:41 UTC (rev 46061)
+++ trunk/WebCore/html/HTMLInputElement.idl        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx">                  attribute [ConvertNullToNullString] DOMString name;
</span><span class="cx">                  attribute DOMString       placeholder;
</span><span class="cx">                  attribute boolean         readOnly;
</span><ins>+                 attribute boolean         required;
</ins><span class="cx"> #if defined(LANGUAGE_OBJECTIVE_C) &amp;&amp; LANGUAGE_OBJECTIVE_C
</span><span class="cx">                  attribute [ConvertToString] DOMString size; // DOM level 2 changed this to a long, but our existing API is a string
</span><span class="cx"> #else
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLSelectElementh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLSelectElement.h (46061 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLSelectElement.h        2009-07-17 22:30:41 UTC (rev 46061)
+++ trunk/WebCore/html/HTMLSelectElement.h        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -130,6 +130,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void insertedIntoTree(bool);
</span><span class="cx"> 
</span><ins>+    virtual bool isOptionalFormControl() const { return true; }
+
</ins><span class="cx">     SelectElementData m_data;
</span><span class="cx">     CollectionCache m_collectionInfo;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLTextAreaElementh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLTextAreaElement.h (46061 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLTextAreaElement.h        2009-07-17 22:30:41 UTC (rev 46061)
+++ trunk/WebCore/html/HTMLTextAreaElement.h        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -52,6 +52,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool isTextFormControl() const { return true; }
</span><span class="cx"> 
</span><ins>+    virtual bool valueMissing() const { return isRequiredFormControl() &amp;&amp; !disabled() &amp;&amp; !readOnly() &amp;&amp; value().isEmpty(); }
+
</ins><span class="cx">     int selectionStart();
</span><span class="cx">     int selectionEnd();
</span><span class="cx"> 
</span><span class="lines">@@ -96,6 +98,9 @@
</span><span class="cx"> 
</span><span class="cx">     void updateValue() const;
</span><span class="cx"> 
</span><ins>+    virtual bool isOptionalFormControl() const { return !isRequiredFormControl(); }
+    virtual bool isRequiredFormControl() const { return required(); }
+
</ins><span class="cx">     int m_rows;
</span><span class="cx">     int m_cols;
</span><span class="cx">     WrapMethod m_wrap;
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLTextAreaElementidl"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLTextAreaElement.idl (46061 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLTextAreaElement.idl        2009-07-17 22:30:41 UTC (rev 46061)
+++ trunk/WebCore/html/HTMLTextAreaElement.idl        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx">                  attribute  boolean              autofocus;
</span><span class="cx">                  attribute  [ConvertNullToNullString] DOMString            name;
</span><span class="cx">                  attribute  boolean              readOnly;
</span><ins>+                 attribute  boolean              required;
</ins><span class="cx">                  attribute  long                 rows;
</span><span class="cx">         readonly attribute  DOMString            type;
</span><span class="cx">                  attribute  [ConvertNullToNullString] DOMString            value;
</span></span></pre></div>
<a id="trunkWebCorehtmlValidityStatecpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/ValidityState.cpp (46061 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/ValidityState.cpp        2009-07-17 22:30:41 UTC (rev 46061)
+++ trunk/WebCore/html/ValidityState.cpp        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -22,7 +22,6 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;ValidityState.h&quot;
</span><del>-#include &quot;HTMLFormControlElement.h&quot;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkWebCorehtmlValidityStateh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/ValidityState.h (46061 => 46062)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/ValidityState.h        2009-07-17 22:30:41 UTC (rev 46061)
+++ trunk/WebCore/html/ValidityState.h        2009-07-17 22:37:41 UTC (rev 46062)
</span><span class="lines">@@ -23,13 +23,12 @@
</span><span class="cx"> #ifndef ValidityState_h
</span><span class="cx"> #define ValidityState_h
</span><span class="cx"> 
</span><ins>+#include &quot;HTMLFormControlElement.h&quot;
</ins><span class="cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/RefCounted.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-    class HTMLFormControlElement;
-
</del><span class="cx">     class ValidityState : public RefCounted&lt;ValidityState&gt; {
</span><span class="cx">     public:
</span><span class="cx">         static PassRefPtr&lt;ValidityState&gt; create(HTMLFormControlElement* owner)
</span><span class="lines">@@ -39,7 +38,7 @@
</span><span class="cx"> 
</span><span class="cx">         HTMLFormControlElement* control() const { return m_control; }
</span><span class="cx"> 
</span><del>-        bool valueMissing() { return false; }
</del><ins>+        bool valueMissing() { return control()-&gt;valueMissing(); }
</ins><span class="cx">         bool typeMismatch() { return false; }
</span><span class="cx">         bool patternMismatch() { return false; }
</span><span class="cx">         bool tooLong() { return false; }
</span></span></pre>
</div>
</div>

</body>
</html>