<!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>[46423] 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/46423">46423</a></dd>
<dt>Author</dt> <dd>pkasting@chromium.org</dd>
<dt>Date</dt> <dd>2009-07-27 11:32:23 -0700 (Mon, 27 Jul 2009)</dd>
</dl>

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

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

        Reviewed by Darin Adler.

        https://bugs.webkit.org/show_bug.cgi?id=25552
        Added new &quot;pattern&quot; attribute to HTMLInputElement and validation code
        (validity.patternMismatch) as per HTML5 specs.
        http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#attr-input-pattern

        Tests: fast/forms/ValidityState-002.html
               fast/forms/ValidityState-patternMismatch-001.html
               fast/forms/ValidityState-patternMismatch-002.html
               fast/forms/ValidityState-patternMismatch-003.html
               fast/forms/ValidityState-patternMismatch-004.html
               fast/forms/ValidityState-patternMismatch-005.html
               fast/forms/ValidityState-patternMismatch-006.html
               fast/forms/ValidityState-patternMismatch-007.html
               fast/forms/pattern-attribute-001.html
               fast/forms/pattern-attribute-002.html
               fast/forms/pattern-attribute-003.html

        * html/HTMLAttributeNames.in: pattern attribute
        * html/HTMLFormControlElement.h:
        (WebCore::HTMLFormControlElement::patternMismatch): method definition
        * html/HTMLInputElement.cpp:
        (WebCore::HTMLInputElement::patternMismatch): validation method
        * html/HTMLInputElement.h:
        * html/HTMLInputElement.idl:
        * html/ValidityState.h:
        (WebCore::ValidityState::patternMismatch): validation flag

LayoutTests:

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

        Reviewed by Darin Adler.

        https://bugs.webkit.org/show_bug.cgi?id=25552
        First series of tests for the &quot;pattern&quot; attribute and related validation
        code

        * fast/forms/ValidityState-002-expected.txt: Copied from LayoutTests/fast/forms/willvalidate-001-expected.txt.
        * fast/forms/ValidityState-002.html: Added.
        * fast/forms/ValidityState-patternMismatch-001-expected.txt: Added.
        * fast/forms/ValidityState-patternMismatch-001.html: Added.
        * fast/forms/ValidityState-patternMismatch-002-expected.txt: Added.
        * fast/forms/ValidityState-patternMismatch-002.html: Added.
        * fast/forms/ValidityState-patternMismatch-003-expected.txt: Added.
        * fast/forms/ValidityState-patternMismatch-003.html: Added.
        * fast/forms/ValidityState-patternMismatch-004-expected.txt: Added.
        * fast/forms/ValidityState-patternMismatch-004.html: Added.
        * fast/forms/ValidityState-patternMismatch-005-expected.txt: Added.
        * fast/forms/ValidityState-patternMismatch-005.html: Added.
        * fast/forms/ValidityState-patternMismatch-006-expected.txt: Added.
        * fast/forms/ValidityState-patternMismatch-006.html: Added.
        * fast/forms/ValidityState-patternMismatch-007-expected.txt: Added.
        * fast/forms/ValidityState-patternMismatch-007.html: Added.
        * fast/forms/pattern-attribute-001-expected.txt: Added.
        * fast/forms/pattern-attribute-001.html: Added.
        * fast/forms/pattern-attribute-002-expected.txt: Added.
        * fast/forms/pattern-attribute-002.html: Added.
        * fast/forms/pattern-attribute-003-expected.txt: Added.
        * fast/forms/pattern-attribute-003.html: Added.</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="#trunkWebCorehtmlHTMLAttributeNamesin">trunk/WebCore/html/HTMLAttributeNames.in</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="#trunkWebCorehtmlValidityStateh">trunk/WebCore/html/ValidityState.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastformsValidityState002expectedtxt">trunk/LayoutTests/fast/forms/ValidityState-002-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityState002html">trunk/LayoutTests/fast/forms/ValidityState-002.html</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatepatternMismatch001expectedtxt">trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-001-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatepatternMismatch001html">trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-001.html</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatepatternMismatch002expectedtxt">trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-002-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatepatternMismatch002html">trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-002.html</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatepatternMismatch003expectedtxt">trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-003-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatepatternMismatch003html">trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-003.html</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatepatternMismatch004expectedtxt">trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-004-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatepatternMismatch004html">trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-004.html</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatepatternMismatch005expectedtxt">trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-005-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatepatternMismatch005html">trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-005.html</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatepatternMismatch006expectedtxt">trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-006-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatepatternMismatch006html">trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-006.html</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatepatternMismatch007expectedtxt">trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-007-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsValidityStatepatternMismatch007html">trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-007.html</a></li>
<li><a href="#trunkLayoutTestsfastformspatternattribute001expectedtxt">trunk/LayoutTests/fast/forms/pattern-attribute-001-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformspatternattribute001html">trunk/LayoutTests/fast/forms/pattern-attribute-001.html</a></li>
<li><a href="#trunkLayoutTestsfastformspatternattribute002expectedtxt">trunk/LayoutTests/fast/forms/pattern-attribute-002-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformspatternattribute002html">trunk/LayoutTests/fast/forms/pattern-attribute-002.html</a></li>
<li><a href="#trunkLayoutTestsfastformspatternattribute003expectedtxt">trunk/LayoutTests/fast/forms/pattern-attribute-003-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformspatternattribute003html">trunk/LayoutTests/fast/forms/pattern-attribute-003.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (46422 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2009-07-27 18:22:54 UTC (rev 46422)
+++ trunk/LayoutTests/ChangeLog        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2009-07-27  Michelangelo De Simone  &lt;micdesim@gmail.com&gt;
+
+        Reviewed by Darin Adler.
+
+        https://bugs.webkit.org/show_bug.cgi?id=25552
+        First series of tests for the &quot;pattern&quot; attribute and related validation
+        code
+
+        * fast/forms/ValidityState-002-expected.txt: Copied from LayoutTests/fast/forms/willvalidate-001-expected.txt.
+        * fast/forms/ValidityState-002.html: Added.
+        * fast/forms/ValidityState-patternMismatch-001-expected.txt: Added.
+        * fast/forms/ValidityState-patternMismatch-001.html: Added.
+        * fast/forms/ValidityState-patternMismatch-002-expected.txt: Added.
+        * fast/forms/ValidityState-patternMismatch-002.html: Added.
+        * fast/forms/ValidityState-patternMismatch-003-expected.txt: Added.
+        * fast/forms/ValidityState-patternMismatch-003.html: Added.
+        * fast/forms/ValidityState-patternMismatch-004-expected.txt: Added.
+        * fast/forms/ValidityState-patternMismatch-004.html: Added.
+        * fast/forms/ValidityState-patternMismatch-005-expected.txt: Added.
+        * fast/forms/ValidityState-patternMismatch-005.html: Added.
+        * fast/forms/ValidityState-patternMismatch-006-expected.txt: Added.
+        * fast/forms/ValidityState-patternMismatch-006.html: Added.
+        * fast/forms/ValidityState-patternMismatch-007-expected.txt: Added.
+        * fast/forms/ValidityState-patternMismatch-007.html: Added.
+        * fast/forms/pattern-attribute-001-expected.txt: Added.
+        * fast/forms/pattern-attribute-001.html: Added.
+        * fast/forms/pattern-attribute-002-expected.txt: Added.
+        * fast/forms/pattern-attribute-002.html: Added.
+        * fast/forms/pattern-attribute-003-expected.txt: Added.
+        * fast/forms/pattern-attribute-003.html: Added.
+
</ins><span class="cx"> 2009-07-27  Jian Li  &lt;jianli@chromium.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by David Levin.
</span></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityState002expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-002-expected.txt (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-002-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-002-expected.txt        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+
+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityState002html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-002.html (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-002.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-002.html        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;patternMismatch and 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.patternMismatch &amp;&amp; v[0].validity.valueMissing ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;[0-9][A-Z]{3}&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="trunkLayoutTestsfastformsValidityStatepatternMismatch001expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-001-expected.txt (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-001-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-001-expected.txt        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+There is an input type text with pattern attribute set to [0-9][A-Z]{3}, checking its validity.patternMismatch flag.
+
+
+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatepatternMismatch001html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-001.html (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-001.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-001.html        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;basic patternMismatch 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].validity.patternMismatch ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;There is an input type text with pattern attribute set to [0-9][A-Z]{3}, checking its validity.patternMismatch flag.&lt;/p&gt;
+&lt;input name=&quot;victim&quot; pattern=&quot;[0-9][A-Z]{3}&quot; value=&quot;0AAA&quot;/&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="trunkLayoutTestsfastformsValidityStatepatternMismatch002expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-002-expected.txt (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-002-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-002-expected.txt        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+There is an input type text with no pattern attribute.
+
+
+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatepatternMismatch002html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-002.html (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-002.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-002.html        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;basic patternMismatch test 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.patternMismatch ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;There is an input type text with no pattern attribute.&lt;/p&gt;
+&lt;input name=&quot;victim&quot; /&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="trunkLayoutTestsfastformsValidityStatepatternMismatch003expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-003-expected.txt (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-003-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-003-expected.txt        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,20 @@
</span><ins>+IP Address:  Email address:                  
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatepatternMismatch003html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-003.html (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-003.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-003.html        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;basic patternMismatch test 3&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.patternMismatch ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+IP Address:
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b&quot; value=&quot;127.0.0.1&quot; /&gt;
+Email address:
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;[a-z0-9!#$%&amp;'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&amp;'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?&quot; value=&quot;someone@somewhere.com&quot; /&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;\b(word1|word2|word3)(?:\W+\w+){1,6}?\W+(word1|word2|word3)\b&quot; value=&quot;word1 near word2&quot; /&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;.{5,}&quot; value=&quot;12345&quot; /&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;.{5,}&quot; value=&quot;*(@$!&quot; /&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;.{5,}&quot; value=&quot;*(@^$!&quot; /&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;0|1|2|3|4|5|6|7|8|&quot; value=&quot;3&quot; /&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;^(foo).*&quot; value=&quot;foo&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;^(foo).*&quot; value=&quot;fooo&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;\w&quot; value=&quot;f&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;\.&quot; value=&quot;.&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;\)\(&quot; value=&quot;)(&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;ab&quot; value=&quot;ab&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;^ab&quot; value=&quot;ab&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;^\(&quot; value=&quot;(&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;...\)\(...&quot; value=&quot;aaa)(bbb&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;^&quot; value=&quot;&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;$&quot; value=&quot;&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;foobar&quot; value=&quot;&quot;/&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="trunkLayoutTestsfastformsValidityStatepatternMismatch004expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-004-expected.txt (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-004-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-004-expected.txt        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+SUCCESS
+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatepatternMismatch004html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-004.html (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-004.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-004.html        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;basic patternMismatch test 4&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.patternMismatch ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+        v[0].value = &quot;someone@somewhere.com&quot;;
+        log(!v[0].validity.patternMismatch ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;[a-z0-9!#$%&amp;'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&amp;'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?&quot; value=&quot;Wrong!&quot;/&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="trunkLayoutTestsfastformsValidityStatepatternMismatch005expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-005-expected.txt (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-005-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-005-expected.txt        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatepatternMismatch005html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-005.html (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-005.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-005.html        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;basic patternMismatch test 5&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.patternMismatch ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+        v[0].value = &quot;gray&quot;;
+        log(!v[0].validity.patternMismatch ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+        v[0].value = &quot;grey&quot;;
+        log(!v[0].validity.patternMismatch ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+        v[0].value = &quot;&quot;;
+        log(!v[0].validity.patternMismatch ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;gr[ae]y&quot; value=&quot;Wrong!&quot;/&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="trunkLayoutTestsfastformsValidityStatepatternMismatch006expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-006-expected.txt (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-006-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-006-expected.txt        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+                   
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatepatternMismatch006html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-006.html (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-006.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-006.html        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;basic patternMismatch test 6&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.patternMismatch ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;((4\.[0-3])|(2\.[0-3]))&quot; value=&quot;Something 4.0&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;\w&quot; value=&quot;*&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;email&quot; pattern=&quot;[0-9]&quot; value=&quot;something&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;.{5,}&quot; value=&quot;1234&quot; /&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;.{5,}&quot; value=&quot;*)$!&quot; /&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;.{5,}&quot; value=&quot;(^$!&quot; /&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;0|1|2|3|4|5|6|7|8|&quot; value=&quot;a&quot; /&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;^(foo).*&quot; value=&quot;a foo&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;\w&quot; value=&quot;134&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;\.&quot; value=&quot;\.&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;\)\(&quot; value=&quot;) (&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;ab&quot; value=&quot;a&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;ab&quot; value=&quot;b&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;^ab&quot; value=&quot;abc&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;^\(&quot; value=&quot;(something&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;\)\\&quot; value=&quot;something)\&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;...\)\([b]{3}&quot; value=&quot;adf)(bbbTEST&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;foo\\&quot; value=&quot;food&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;^&quot; value=&quot;wrong&quot;/&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;$&quot; value=&quot;wrong&quot;/&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="trunkLayoutTestsfastformsValidityStatepatternMismatch007expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-007-expected.txt (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-007-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-007-expected.txt        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+
+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsValidityStatepatternMismatch007html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-007.html (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-007.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ValidityState-patternMismatch-007.html        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;basic patternMismatch test 7&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.patternMismatch ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;input name=&quot;victim&quot; type=&quot;text&quot; pattern=&quot;&quot; value=&quot;Lorem Ipsum&quot;/&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="trunkLayoutTestsfastformspatternattribute001expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/pattern-attribute-001-expected.txt (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/pattern-attribute-001-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/pattern-attribute-001-expected.txt        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+There an input element with the pattern attribute set.
+
+
+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformspatternattribute001html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/pattern-attribute-001.html (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/pattern-attribute-001.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/pattern-attribute-001.html        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;pattern 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].pattern ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;There an input element with the pattern attribute set.&lt;/p&gt;
+&lt;input name=&quot;victim&quot; pattern=&quot;something&quot; /&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="trunkLayoutTestsfastformspatternattribute002expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/pattern-attribute-002-expected.txt (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/pattern-attribute-002-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/pattern-attribute-002-expected.txt        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+There an input element with the pattern attribute not set.
+
+
+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformspatternattribute002html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/pattern-attribute-002.html (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/pattern-attribute-002.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/pattern-attribute-002.html        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;pattern attribute set/get 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;);
+        v[0].pattern = &quot;something&quot;;
+        log(v[0].pattern == &quot;something&quot; ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;There an input element with the pattern attribute not set.&lt;/p&gt;
+&lt;input name=&quot;victim&quot; /&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="trunkLayoutTestsfastformspatternattribute003expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/pattern-attribute-003-expected.txt (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/pattern-attribute-003-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/pattern-attribute-003-expected.txt        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+There an input element with the pattern attribute set.
+
+
+SUCCESS
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformspatternattribute003html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/pattern-attribute-003.html (0 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/pattern-attribute-003.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/pattern-attribute-003.html        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+&lt;title&gt;pattern attribute set 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;);
+        v[0].pattern += &quot; else&quot;;
+        log(v[0].pattern == &quot;something else&quot; ? &quot;SUCCESS&quot; : &quot;FAILURE&quot;);
+    }
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;test()&quot;&gt;
+&lt;p&gt;There an input element with the pattern attribute set.&lt;/p&gt;
+&lt;input name=&quot;victim&quot; pattern=&quot;something&quot; /&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 (46422 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2009-07-27 18:22:54 UTC (rev 46422)
+++ trunk/WebCore/ChangeLog        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2009-07-27  Michelangelo De Simone  &lt;micdesim@gmail.com&gt;
+
+        Reviewed by Darin Adler.
+
+        https://bugs.webkit.org/show_bug.cgi?id=25552
+        Added new &quot;pattern&quot; attribute to HTMLInputElement and validation code
+        (validity.patternMismatch) as per HTML5 specs.
+        http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#attr-input-pattern
+
+        Tests: fast/forms/ValidityState-002.html
+               fast/forms/ValidityState-patternMismatch-001.html
+               fast/forms/ValidityState-patternMismatch-002.html
+               fast/forms/ValidityState-patternMismatch-003.html
+               fast/forms/ValidityState-patternMismatch-004.html
+               fast/forms/ValidityState-patternMismatch-005.html
+               fast/forms/ValidityState-patternMismatch-006.html
+               fast/forms/ValidityState-patternMismatch-007.html
+               fast/forms/pattern-attribute-001.html
+               fast/forms/pattern-attribute-002.html
+               fast/forms/pattern-attribute-003.html
+
+        * html/HTMLAttributeNames.in: pattern attribute
+        * html/HTMLFormControlElement.h:
+        (WebCore::HTMLFormControlElement::patternMismatch): method definition
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::patternMismatch): validation method
+        * html/HTMLInputElement.h:
+        * html/HTMLInputElement.idl:
+        * html/ValidityState.h:
+        (WebCore::ValidityState::patternMismatch): validation flag
+
</ins><span class="cx"> 2009-07-27  Nikolas Zimmermann  &lt;nikolas.zimmermann@torchmobile.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by George Staikos.
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLAttributeNamesin"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLAttributeNames.in (46422 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLAttributeNames.in        2009-07-27 18:22:54 UTC (rev 46422)
+++ trunk/WebCore/html/HTMLAttributeNames.in        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -185,6 +185,7 @@
</span><span class="cx"> onwebkitanimationiteration
</span><span class="cx"> onwebkitanimationend
</span><span class="cx"> onwebkittransitionend
</span><ins>+pattern
</ins><span class="cx"> placeholder
</span><span class="cx"> pluginurl
</span><span class="cx"> poster
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLFormControlElementh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLFormControlElement.h (46422 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLFormControlElement.h        2009-07-27 18:22:54 UTC (rev 46422)
+++ trunk/WebCore/html/HTMLFormControlElement.h        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -105,6 +105,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool willValidate() const;
</span><span class="cx"> 
</span><ins>+    virtual bool patternMismatch() const { return false; }
+
</ins><span class="cx">     void formDestroyed() { m_form = 0; }
</span><span class="cx"> 
</span><span class="cx">     virtual void dispatchFocusEvent();
</span></span></pre></div>
<a id="trunkWebCorehtmlHTMLInputElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLInputElement.cpp (46422 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLInputElement.cpp        2009-07-27 18:22:54 UTC (rev 46422)
+++ trunk/WebCore/html/HTMLInputElement.cpp        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx"> #include &quot;MappedAttribute.h&quot;
</span><span class="cx"> #include &quot;MouseEvent.h&quot;
</span><span class="cx"> #include &quot;Page.h&quot;
</span><ins>+#include &quot;RegularExpression.h&quot;
</ins><span class="cx"> #include &quot;RenderButton.h&quot;
</span><span class="cx"> #include &quot;RenderFileUploadControl.h&quot;
</span><span class="cx"> #include &quot;RenderImage.h&quot;
</span><span class="lines">@@ -147,6 +148,46 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool HTMLInputElement::patternMismatch() const
+{
+    switch (inputType()) {
+        case ISINDEX:
+        case CHECKBOX:
+        case RADIO:
+        case SUBMIT:
+        case RESET:
+        case FILE:
+        case HIDDEN:
+        case IMAGE:
+        case BUTTON:
+        case RANGE:
+        case NUMBER:
+            return false;
+        case TEXT:
+        case SEARCH:
+        case URL:
+        case TELEPHONE:
+        case EMAIL:
+        case PASSWORD:
+            const AtomicString&amp; pattern = getAttribute(patternAttr);
+            String value = this-&gt;value();
+
+            // Empty values can't be mismatched
+            if (pattern.isEmpty() || value.isEmpty())
+                return false;
+
+            RegularExpression patternRegExp(pattern, TextCaseSensitive);
+            int matchLength = 0;
+            int valueLength = value.length();
+            int matchOffset = patternRegExp.match(value, 0, &amp;matchLength);
+
+            return matchOffset != 0 || matchLength != valueLength;
+    }
+
+    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></pre></div>
<a id="trunkWebCorehtmlHTMLInputElementh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLInputElement.h (46422 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLInputElement.h        2009-07-27 18:22:54 UTC (rev 46422)
+++ trunk/WebCore/html/HTMLInputElement.h        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -91,6 +91,7 @@
</span><span class="cx">     virtual bool isTextFormControl() const { return isTextField(); }
</span><span class="cx"> 
</span><span class="cx">     virtual bool valueMissing() const;
</span><ins>+    virtual bool patternMismatch() const;
</ins><span class="cx"> 
</span><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></pre></div>
<a id="trunkWebCorehtmlHTMLInputElementidl"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/HTMLInputElement.idl (46422 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/HTMLInputElement.idl        2009-07-27 18:22:54 UTC (rev 46422)
+++ trunk/WebCore/html/HTMLInputElement.idl        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -41,6 +41,7 @@
</span><span class="cx">                  attribute long            maxLength;
</span><span class="cx">                  attribute boolean         multiple;
</span><span class="cx">                  attribute [ConvertNullToNullString] DOMString name;
</span><ins>+                 attribute [Reflect] DOMString       pattern;
</ins><span class="cx">                  attribute DOMString       placeholder;
</span><span class="cx">                  attribute boolean         readOnly;
</span><span class="cx">                  attribute boolean         required;
</span></span></pre></div>
<a id="trunkWebCorehtmlValidityStateh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/ValidityState.h (46422 => 46423)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/ValidityState.h        2009-07-27 18:22:54 UTC (rev 46422)
+++ trunk/WebCore/html/ValidityState.h        2009-07-27 18:32:23 UTC (rev 46423)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx"> 
</span><span class="cx">         bool valueMissing() { return control()-&gt;valueMissing(); }
</span><span class="cx">         bool typeMismatch() { return false; }
</span><del>-        bool patternMismatch() { return false; }
</del><ins>+        bool patternMismatch() { return control()-&gt;patternMismatch(); }
</ins><span class="cx">         bool tooLong() { return false; }
</span><span class="cx">         bool rangeUnderflow() { return false; }
</span><span class="cx">         bool rangeOverflow() { return false; }
</span></span></pre>
</div>
</div>

</body>
</html>