<!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>[191981] 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/191981">191981</a></dd>
<dt>Author</dt> <dd>jhoneycutt@apple.com</dd>
<dt>Date</dt> <dd>2015-11-03 14:51:52 -0800 (Tue, 03 Nov 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Implement support for the autocomplete attribute
https://bugs.webkit.org/show_bug.cgi?id=150731
rdar://problem/21078968

LayoutTests/imported/w3c:

Reviewed by Brent Fulgham.

* web-platform-tests/html/dom/interfaces-expected.txt: Rebased.
* web-platform-tests/html/semantics/forms/the-form-element/form-autocomplete-expected.txt:
Rebased.

Source/WebCore:

The autocomplete attribute is defined by
https://html.spec.whatwg.org/multipage/forms.html#autofill.

Reviewed by Brent Fulgham.

Test: fast/forms/autocomplete-tokens.html

* html/HTMLFormControlElement.cpp:
(WebCore::isContactToken):
Return true if this is a contact token.
(WebCore::categoryForAutofillFieldToken):
Adds all of the autofill field tokens to a map, and returns the
category for a given token.
(WebCore::maxTokensForAutofillFieldCategory):
Return the maximum number of tokens an autofill category supports.
(WebCore::HTMLFormControlElement::parseAutocompleteAttribute):
Implement the processing model defined in
https://html.spec.whatwg.org/multipage/forms.html#processing-model-3
with respect to the IDL-exposed autofill value.
(WebCore::HTMLFormControlElement::setAutocomplete):
Set the autocomplete attribute to the given string.

* html/HTMLFormControlElement.h:
Declare setAutocomplete() and autocomplete().

* html/HTMLInputElement.idl:
Remove the Reflect attribute. We now have custom processing for getting
this attribute.

* html/HTMLSelectElement.idl:
Declare the autocomplete attribute.

* html/HTMLTextAreaElement.idl:
Ditto.

LayoutTests:

Reviewed by Brent Fulgham.

* fast/forms/autocomplete-tokens-expected.txt: Added.
* fast/forms/autocomplete-tokens.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmldominterfacesexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsemanticsformstheformelementformautocompleteexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-autocomplete-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLFormControlElementcpp">trunk/Source/WebCore/html/HTMLFormControlElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLFormControlElementh">trunk/Source/WebCore/html/HTMLFormControlElement.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLInputElementidl">trunk/Source/WebCore/html/HTMLInputElement.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLSelectElementidl">trunk/Source/WebCore/html/HTMLSelectElement.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTextAreaElementidl">trunk/Source/WebCore/html/HTMLTextAreaElement.idl</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastformsautocompletetokensexpectedtxt">trunk/LayoutTests/fast/forms/autocomplete-tokens-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsautocompletetokenshtml">trunk/LayoutTests/fast/forms/autocomplete-tokens.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (191980 => 191981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-11-03 22:24:14 UTC (rev 191980)
+++ trunk/LayoutTests/ChangeLog        2015-11-03 22:51:52 UTC (rev 191981)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2015-10-30  Jon Honeycutt  &lt;jhoneycutt@apple.com&gt;
+
+        Implement support for the autocomplete attribute
+        https://bugs.webkit.org/show_bug.cgi?id=150731
+        rdar://problem/21078968
+
+        Reviewed by Brent Fulgham.
+
+        * fast/forms/autocomplete-tokens-expected.txt: Added.
+        * fast/forms/autocomplete-tokens.html: Added.
+
</ins><span class="cx"> 2015-11-03  Nan Wang  &lt;n_wang@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         AX: Add support for ARIA 1.1 attribute 'aria-modal' for dialog and alertdialog
</span></span></pre></div>
<a id="trunkLayoutTestsfastformsautocompletetokensexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/autocomplete-tokens-expected.txt (0 => 191981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/autocomplete-tokens-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/autocomplete-tokens-expected.txt        2015-11-03 22:51:52 UTC (rev 191981)
</span><span class="lines">@@ -0,0 +1,211 @@
</span><ins>+Tests for valid autocomplete tokens on input, select, and textarea elements.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Valid keywords:
+PASS input.autocomplete is &quot;name&quot;
+PASS input.autocomplete is &quot;honorific-prefix&quot;
+PASS input.autocomplete is &quot;given-name&quot;
+PASS input.autocomplete is &quot;additional-name&quot;
+PASS input.autocomplete is &quot;family-name&quot;
+PASS input.autocomplete is &quot;honorific-suffix&quot;
+PASS input.autocomplete is &quot;nickname&quot;
+PASS input.autocomplete is &quot;organization-title&quot;
+PASS input.autocomplete is &quot;username&quot;
+PASS input.autocomplete is &quot;new-password&quot;
+PASS input.autocomplete is &quot;current-password&quot;
+PASS input.autocomplete is &quot;organization&quot;
+PASS input.autocomplete is &quot;street-address&quot;
+PASS input.autocomplete is &quot;address-line1&quot;
+PASS input.autocomplete is &quot;address-line2&quot;
+PASS input.autocomplete is &quot;address-line3&quot;
+PASS input.autocomplete is &quot;address-level4&quot;
+PASS input.autocomplete is &quot;address-level3&quot;
+PASS input.autocomplete is &quot;address-level2&quot;
+PASS input.autocomplete is &quot;address-level1&quot;
+PASS input.autocomplete is &quot;country&quot;
+PASS input.autocomplete is &quot;country-name&quot;
+PASS input.autocomplete is &quot;postal-code&quot;
+PASS input.autocomplete is &quot;cc-name&quot;
+PASS input.autocomplete is &quot;cc-given-name&quot;
+PASS input.autocomplete is &quot;cc-additional-name&quot;
+PASS input.autocomplete is &quot;cc-family-name&quot;
+PASS input.autocomplete is &quot;cc-number&quot;
+PASS input.autocomplete is &quot;cc-exp&quot;
+PASS input.autocomplete is &quot;cc-exp-month&quot;
+PASS input.autocomplete is &quot;cc-exp-year&quot;
+PASS input.autocomplete is &quot;cc-csc&quot;
+PASS input.autocomplete is &quot;cc-type&quot;
+PASS input.autocomplete is &quot;transaction-currency&quot;
+PASS input.autocomplete is &quot;transaction-amount&quot;
+PASS input.autocomplete is &quot;language&quot;
+PASS input.autocomplete is &quot;bday&quot;
+PASS input.autocomplete is &quot;bday-day&quot;
+PASS input.autocomplete is &quot;bday-month&quot;
+PASS input.autocomplete is &quot;bday-year&quot;
+PASS input.autocomplete is &quot;sex&quot;
+PASS input.autocomplete is &quot;url&quot;
+PASS input.autocomplete is &quot;photo&quot;
+PASS input.autocomplete is &quot;tel&quot;
+PASS input.autocomplete is &quot;tel-country-code&quot;
+PASS input.autocomplete is &quot;tel-national&quot;
+PASS input.autocomplete is &quot;tel-area-code&quot;
+PASS input.autocomplete is &quot;tel-local&quot;
+PASS input.autocomplete is &quot;tel-local-prefix&quot;
+PASS input.autocomplete is &quot;tel-local-suffix&quot;
+PASS input.autocomplete is &quot;tel-extension&quot;
+PASS input.autocomplete is &quot;email&quot;
+PASS input.autocomplete is &quot;impp&quot;
+
+Contact scope:
+PASS input.autocomplete is &quot;home tel&quot;
+PASS input.autocomplete is &quot;home tel-country-code&quot;
+PASS input.autocomplete is &quot;home tel-national&quot;
+PASS input.autocomplete is &quot;home tel-area-code&quot;
+PASS input.autocomplete is &quot;home tel-local&quot;
+PASS input.autocomplete is &quot;home tel-local-prefix&quot;
+PASS input.autocomplete is &quot;home tel-local-suffix&quot;
+PASS input.autocomplete is &quot;home tel-extension&quot;
+PASS input.autocomplete is &quot;home email&quot;
+PASS input.autocomplete is &quot;home impp&quot;
+PASS input.autocomplete is &quot;work tel&quot;
+PASS input.autocomplete is &quot;work tel-country-code&quot;
+PASS input.autocomplete is &quot;work tel-national&quot;
+PASS input.autocomplete is &quot;work tel-area-code&quot;
+PASS input.autocomplete is &quot;work tel-local&quot;
+PASS input.autocomplete is &quot;work tel-local-prefix&quot;
+PASS input.autocomplete is &quot;work tel-local-suffix&quot;
+PASS input.autocomplete is &quot;work tel-extension&quot;
+PASS input.autocomplete is &quot;work email&quot;
+PASS input.autocomplete is &quot;work impp&quot;
+PASS input.autocomplete is &quot;mobile tel&quot;
+PASS input.autocomplete is &quot;mobile tel-country-code&quot;
+PASS input.autocomplete is &quot;mobile tel-national&quot;
+PASS input.autocomplete is &quot;mobile tel-area-code&quot;
+PASS input.autocomplete is &quot;mobile tel-local&quot;
+PASS input.autocomplete is &quot;mobile tel-local-prefix&quot;
+PASS input.autocomplete is &quot;mobile tel-local-suffix&quot;
+PASS input.autocomplete is &quot;mobile tel-extension&quot;
+PASS input.autocomplete is &quot;mobile email&quot;
+PASS input.autocomplete is &quot;mobile impp&quot;
+PASS input.autocomplete is &quot;fax tel&quot;
+PASS input.autocomplete is &quot;fax tel-country-code&quot;
+PASS input.autocomplete is &quot;fax tel-national&quot;
+PASS input.autocomplete is &quot;fax tel-area-code&quot;
+PASS input.autocomplete is &quot;fax tel-local&quot;
+PASS input.autocomplete is &quot;fax tel-local-prefix&quot;
+PASS input.autocomplete is &quot;fax tel-local-suffix&quot;
+PASS input.autocomplete is &quot;fax tel-extension&quot;
+PASS input.autocomplete is &quot;fax email&quot;
+PASS input.autocomplete is &quot;fax impp&quot;
+PASS input.autocomplete is &quot;pager tel&quot;
+PASS input.autocomplete is &quot;pager tel-country-code&quot;
+PASS input.autocomplete is &quot;pager tel-national&quot;
+PASS input.autocomplete is &quot;pager tel-area-code&quot;
+PASS input.autocomplete is &quot;pager tel-local&quot;
+PASS input.autocomplete is &quot;pager tel-local-prefix&quot;
+PASS input.autocomplete is &quot;pager tel-local-suffix&quot;
+PASS input.autocomplete is &quot;pager tel-extension&quot;
+PASS input.autocomplete is &quot;pager email&quot;
+PASS input.autocomplete is &quot;pager impp&quot;
+
+Mode:
+PASS input.autocomplete is &quot;shipping street-address&quot;
+PASS input.autocomplete is &quot;shipping address-line1&quot;
+PASS input.autocomplete is &quot;shipping address-line2&quot;
+PASS input.autocomplete is &quot;shipping address-line3&quot;
+PASS input.autocomplete is &quot;shipping address-level4&quot;
+PASS input.autocomplete is &quot;shipping address-level3&quot;
+PASS input.autocomplete is &quot;shipping address-level2&quot;
+PASS input.autocomplete is &quot;shipping address-level1&quot;
+PASS input.autocomplete is &quot;shipping country&quot;
+PASS input.autocomplete is &quot;shipping country-name&quot;
+PASS input.autocomplete is &quot;shipping postal-code&quot;
+PASS input.autocomplete is &quot;billing street-address&quot;
+PASS input.autocomplete is &quot;billing address-line1&quot;
+PASS input.autocomplete is &quot;billing address-line2&quot;
+PASS input.autocomplete is &quot;billing address-line3&quot;
+PASS input.autocomplete is &quot;billing address-level4&quot;
+PASS input.autocomplete is &quot;billing address-level3&quot;
+PASS input.autocomplete is &quot;billing address-level2&quot;
+PASS input.autocomplete is &quot;billing address-level1&quot;
+PASS input.autocomplete is &quot;billing country&quot;
+PASS input.autocomplete is &quot;billing country-name&quot;
+PASS input.autocomplete is &quot;billing postal-code&quot;
+
+Section:
+PASS input.autocomplete is &quot;section-parent name&quot;
+PASS input.autocomplete is &quot;section-parent honorific-prefix&quot;
+PASS input.autocomplete is &quot;section-parent given-name&quot;
+PASS input.autocomplete is &quot;section-parent additional-name&quot;
+PASS input.autocomplete is &quot;section-parent family-name&quot;
+PASS input.autocomplete is &quot;section-parent honorific-suffix&quot;
+PASS input.autocomplete is &quot;section-parent nickname&quot;
+PASS input.autocomplete is &quot;section-parent organization-title&quot;
+PASS input.autocomplete is &quot;section-parent username&quot;
+PASS input.autocomplete is &quot;section-parent new-password&quot;
+PASS input.autocomplete is &quot;section-parent current-password&quot;
+PASS input.autocomplete is &quot;section-parent organization&quot;
+PASS input.autocomplete is &quot;section-parent street-address&quot;
+PASS input.autocomplete is &quot;section-parent address-line1&quot;
+PASS input.autocomplete is &quot;section-parent address-line2&quot;
+PASS input.autocomplete is &quot;section-parent address-line3&quot;
+PASS input.autocomplete is &quot;section-parent address-level4&quot;
+PASS input.autocomplete is &quot;section-parent address-level3&quot;
+PASS input.autocomplete is &quot;section-parent address-level2&quot;
+PASS input.autocomplete is &quot;section-parent address-level1&quot;
+PASS input.autocomplete is &quot;section-parent country&quot;
+PASS input.autocomplete is &quot;section-parent country-name&quot;
+PASS input.autocomplete is &quot;section-parent postal-code&quot;
+PASS input.autocomplete is &quot;section-parent cc-name&quot;
+PASS input.autocomplete is &quot;section-parent cc-given-name&quot;
+PASS input.autocomplete is &quot;section-parent cc-additional-name&quot;
+PASS input.autocomplete is &quot;section-parent cc-family-name&quot;
+PASS input.autocomplete is &quot;section-parent cc-number&quot;
+PASS input.autocomplete is &quot;section-parent cc-exp&quot;
+PASS input.autocomplete is &quot;section-parent cc-exp-month&quot;
+PASS input.autocomplete is &quot;section-parent cc-exp-year&quot;
+PASS input.autocomplete is &quot;section-parent cc-csc&quot;
+PASS input.autocomplete is &quot;section-parent cc-type&quot;
+PASS input.autocomplete is &quot;section-parent transaction-currency&quot;
+PASS input.autocomplete is &quot;section-parent transaction-amount&quot;
+PASS input.autocomplete is &quot;section-parent language&quot;
+PASS input.autocomplete is &quot;section-parent bday&quot;
+PASS input.autocomplete is &quot;section-parent bday-day&quot;
+PASS input.autocomplete is &quot;section-parent bday-month&quot;
+PASS input.autocomplete is &quot;section-parent bday-year&quot;
+PASS input.autocomplete is &quot;section-parent sex&quot;
+PASS input.autocomplete is &quot;section-parent url&quot;
+PASS input.autocomplete is &quot;section-parent photo&quot;
+PASS input.autocomplete is &quot;section-parent tel&quot;
+PASS input.autocomplete is &quot;section-parent tel-country-code&quot;
+PASS input.autocomplete is &quot;section-parent tel-national&quot;
+PASS input.autocomplete is &quot;section-parent tel-area-code&quot;
+PASS input.autocomplete is &quot;section-parent tel-local&quot;
+PASS input.autocomplete is &quot;section-parent tel-local-prefix&quot;
+PASS input.autocomplete is &quot;section-parent tel-local-suffix&quot;
+PASS input.autocomplete is &quot;section-parent tel-extension&quot;
+PASS input.autocomplete is &quot;section-parent email&quot;
+PASS input.autocomplete is &quot;section-parent impp&quot;
+
+Invalid combinations:
+PASS input.autocomplete is &quot;&quot;
+PASS input.autocomplete is &quot;&quot;
+PASS input.autocomplete is &quot;&quot;
+PASS input.autocomplete is &quot;&quot;
+PASS input.autocomplete is &quot;&quot;
+PASS input.autocomplete is &quot;&quot;
+PASS input.autocomplete is &quot;&quot;
+PASS input.autocomplete is &quot;&quot;
+PASS input.autocomplete is &quot;&quot;
+PASS input.autocomplete is &quot;&quot;
+PASS input.autocomplete is &quot;&quot;
+
+Non-autocompleteable controls:
+PASS button.autocomplete is &quot;invalid&quot;
+PASS keygen.autocomplete is &quot;invalid&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsautocompletetokenshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/autocomplete-tokens.html (0 => 191981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/autocomplete-tokens.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/autocomplete-tokens.html        2015-11-03 22:51:52 UTC (rev 191981)
</span><span class="lines">@@ -0,0 +1,105 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+    &lt;head&gt;
+        &lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+    &lt;/head&gt;
+    &lt;body&gt;
+        &lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+        &lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+        &lt;script&gt;
+            description('Tests for valid autocomplete tokens on input, select, and textarea elements.');
+
+            var input = document.createElement('input');
+            var textarea = document.createElement('textarea');
+            var select = document.createElement('select');
+            var button = document.createElement('button');
+            var keygen = document.createElement('keygen');
+            var autocompleteableControls = [ input, textarea, select ];
+
+            var keywords = [ &quot;name&quot;, &quot;honorific-prefix&quot;, &quot;given-name&quot;, &quot;additional-name&quot;, &quot;family-name&quot;, &quot;honorific-suffix&quot;, &quot;nickname&quot;, &quot;organization-title&quot;, &quot;username&quot;, &quot;new-password&quot;, &quot;current-password&quot;, &quot;organization&quot;, &quot;street-address&quot;, &quot;address-line1&quot;, &quot;address-line2&quot;, &quot;address-line3&quot;, &quot;address-level4&quot;, &quot;address-level3&quot;, &quot;address-level2&quot;, &quot;address-level1&quot;, &quot;country&quot;, &quot;country-name&quot;, &quot;postal-code&quot;, &quot;cc-name&quot;, &quot;cc-given-name&quot;, &quot;cc-additional-name&quot;, &quot;cc-family-name&quot;, &quot;cc-number&quot;, &quot;cc-exp&quot;, &quot;cc-exp-month&quot;, &quot;cc-exp-year&quot;, &quot;cc-csc&quot;, &quot;cc-type&quot;, &quot;transaction-currency&quot;, &quot;transaction-amount&quot;, &quot;language&quot;, &quot;bday&quot;, &quo
 t;bday-day&quot;, &quot;bday-month&quot;, &quot;bday-year&quot;, &quot;sex&quot;, &quot;url&quot;, &quot;photo&quot;, &quot;tel&quot;, &quot;tel-country-code&quot;, &quot;tel-national&quot;, &quot;tel-area-code&quot;, &quot;tel-local&quot;, &quot;tel-local-prefix&quot;, &quot;tel-local-suffix&quot;, &quot;tel-extension&quot;, &quot;email&quot;, &quot;impp&quot; ];
+
+            var modeTokens = [ &quot;billing&quot;, &quot;shipping&quot; ];
+
+            debug('Valid keywords:');
+            keywords.forEach(keyword =&gt; {
+                input.autocomplete = keyword;
+                shouldBeEqualToString('input.autocomplete', keyword);
+            });
+
+            debug('');
+            debug('Contact scope:');
+            var contactTokens = [ &quot;tel&quot;, &quot;tel-country-code&quot;, &quot;tel-national&quot;, &quot;tel-area-code&quot;, &quot;tel-local&quot;, &quot;tel-local-prefix&quot;, &quot;tel-local-suffix&quot;, &quot;tel-extension&quot;, &quot;email&quot;, &quot;impp&quot; ];
+            var contactScopeTokens = [ &quot;home&quot;, &quot;work&quot;, &quot;mobile&quot;, &quot;fax&quot;, &quot;pager&quot; ];
+            contactScopeTokens.forEach(scopeToken =&gt; {
+                contactTokens.forEach(contactToken =&gt; {
+                    input.autocomplete = scopeToken + &quot; &quot; + contactToken;
+                    shouldBeEqualToString('input.autocomplete', scopeToken + &quot; &quot; + contactToken);
+                })
+            });
+
+            debug('');
+            debug('Mode:');
+            var addressTokens = [ &quot;street-address&quot;, &quot;address-line1&quot;, &quot;address-line2&quot;, &quot;address-line3&quot;, &quot;address-level4&quot;, &quot;address-level3&quot;, &quot;address-level2&quot;, &quot;address-level1&quot;, &quot;country&quot;, &quot;country-name&quot;, &quot;postal-code&quot; ];
+            var modeTokens = [ &quot;shipping&quot;, &quot;billing&quot; ];
+            modeTokens.forEach(modeToken =&gt; {
+                addressTokens.forEach(addressToken =&gt; {
+                    input.autocomplete = modeToken + &quot; &quot; + addressToken;
+                    shouldBeEqualToString('input.autocomplete', modeToken + &quot; &quot; + addressToken);
+                })
+            });
+
+            debug('');
+            debug('Section:');
+            keywords.forEach(keyword =&gt; {
+                var value = &quot;section-parent &quot; + keyword;
+                input.autocomplete = value;
+                shouldBeEqualToString('input.autocomplete', value);
+            });
+
+            debug('');
+            debug('Invalid combinations:');
+            autocompleteableControls.forEach(control =&gt; {
+                 control.autocomplete = 'invalid';
+                 shouldBeEmptyString('input.autocomplete');
+            });
+            // Two normal tokens
+            input.autocomplete = &quot;name name&quot;;
+            shouldBeEmptyString('input.autocomplete');
+
+            input.autocomplete = &quot;name bday&quot;;
+            shouldBeEmptyString('input.autocomplete');
+
+            // Contact scope token + non-contact token.
+            input.autocomplete = &quot;pager bday&quot;;
+            shouldBeEmptyString('input.autocomplete');
+
+            // Two contact scope tokens.
+            input.autocomplete = &quot;home work tel&quot;;
+            shouldBeEmptyString('input.autocomplete');
+
+            // Two mode tokens.
+            input.autocomplete = &quot;shipping billing tel&quot;;
+            shouldBeEmptyString('input.autocomplete');
+
+            // Two section tokens.
+            input.autocomplete = &quot;section-a section-b tel&quot;;
+            shouldBeEmptyString('input.autocomplete');
+
+            // Anything + on/off.
+            input.autocomplete = &quot;tel on&quot;;
+            shouldBeEmptyString('input.autocomplete');
+
+            input.autocomplete = &quot;tel off&quot;;
+            shouldBeEmptyString('input.autocomplete');
+
+            debug('');
+            debug('Non-autocompleteable controls:');
+            // Buttons and keygens are not autocompleteable, so their autocomplete attribute is not sanitized.
+            button.autocomplete = 'invalid';
+            shouldBeEqualToString('button.autocomplete', 'invalid');
+            keygen.autocomplete = 'invalid';
+            shouldBeEqualToString('keygen.autocomplete', 'invalid');
+        &lt;/script&gt;
+        &lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+    &lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (191980 => 191981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2015-11-03 22:24:14 UTC (rev 191980)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2015-11-03 22:51:52 UTC (rev 191981)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-11-02  Jon Honeycutt  &lt;jhoneycutt@apple.com&gt;
+
+        Implement support for the autocomplete attribute
+        https://bugs.webkit.org/show_bug.cgi?id=150731
+        rdar://problem/21078968
+
+        Reviewed by Brent Fulgham.
+
+        * web-platform-tests/html/dom/interfaces-expected.txt: Rebased.
+        * web-platform-tests/html/semantics/forms/the-form-element/form-autocomplete-expected.txt:
+        Rebased.
+
</ins><span class="cx"> 2015-11-03  Keith Rollin  &lt;krollin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         HTMLOptionElement.text should never return the value of label
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmldominterfacesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt (191980 => 191981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt        2015-11-03 22:24:14 UTC (rev 191980)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt        2015-11-03 22:51:52 UTC (rev 191981)
</span><span class="lines">@@ -464,6 +464,7 @@
</span><span class="cx"> CONSOLE MESSAGE: line 1152: Deprecated attempt to access property 'validity' on a non-HTMLButtonElement object.
</span><span class="cx"> CONSOLE MESSAGE: line 1152: Deprecated attempt to access property 'validationMessage' on a non-HTMLButtonElement object.
</span><span class="cx"> CONSOLE MESSAGE: line 1152: Deprecated attempt to access property 'labels' on a non-HTMLButtonElement object.
</span><ins>+CONSOLE MESSAGE: line 1152: Deprecated attempt to access property 'autocomplete' on a non-HTMLSelectElement object.
</ins><span class="cx"> CONSOLE MESSAGE: line 1152: Deprecated attempt to access property 'autofocus' on a non-HTMLSelectElement object.
</span><span class="cx"> CONSOLE MESSAGE: line 1152: Deprecated attempt to access property 'disabled' on a non-HTMLSelectElement object.
</span><span class="cx"> CONSOLE MESSAGE: line 1152: Deprecated attempt to access property 'form' on a non-HTMLSelectElement object.
</span><span class="lines">@@ -490,6 +491,7 @@
</span><span class="cx"> CONSOLE MESSAGE: line 1152: Deprecated attempt to access property 'value' on a non-HTMLOptionElement object.
</span><span class="cx"> CONSOLE MESSAGE: line 1152: Deprecated attempt to access property 'text' on a non-HTMLOptionElement object.
</span><span class="cx"> CONSOLE MESSAGE: line 1152: Deprecated attempt to access property 'index' on a non-HTMLOptionElement object.
</span><ins>+CONSOLE MESSAGE: line 1152: Deprecated attempt to access property 'autocomplete' on a non-HTMLTextAreaElement object.
</ins><span class="cx"> CONSOLE MESSAGE: line 1152: Deprecated attempt to access property 'autofocus' on a non-HTMLTextAreaElement object.
</span><span class="cx"> CONSOLE MESSAGE: line 1152: Deprecated attempt to access property 'cols' on a non-HTMLTextAreaElement object.
</span><span class="cx"> CONSOLE MESSAGE: line 1152: Deprecated attempt to access property 'dirName' on a non-HTMLTextAreaElement object.
</span><span class="lines">@@ -4423,7 +4425,9 @@
</span><span class="cx"> PASS HTMLSelectElement interface object length 
</span><span class="cx"> PASS HTMLSelectElement interface: existence and properties of interface prototype object 
</span><span class="cx"> FAIL HTMLSelectElement interface: existence and properties of interface prototype object's &quot;constructor&quot; property assert_own_property: HTMLSelectElement.prototype does not have own property &quot;constructor&quot; expected property &quot;constructor&quot; missing
</span><del>-FAIL HTMLSelectElement interface: attribute autocomplete assert_true: The prototype object must have a property &quot;autocomplete&quot; expected true got false
</del><ins>+FAIL HTMLSelectElement interface: attribute autocomplete assert_throws: getting property on prototype object must throw TypeError function &quot;function () {
+    [native code]
+}&quot; did not throw
</ins><span class="cx"> FAIL HTMLSelectElement interface: attribute autofocus assert_throws: getting property on prototype object must throw TypeError function &quot;function () {
</span><span class="cx">     [native code]
</span><span class="cx"> }&quot; did not throw
</span><span class="lines">@@ -4483,7 +4487,7 @@
</span><span class="cx"> }&quot; did not throw
</span><span class="cx"> PASS HTMLSelectElement must be primary interface of document.createElement(&quot;select&quot;) 
</span><span class="cx"> PASS Stringification of document.createElement(&quot;select&quot;) 
</span><del>-FAIL HTMLSelectElement interface: document.createElement(&quot;select&quot;) must inherit property &quot;autocomplete&quot; with the proper type (0) assert_inherits: property &quot;autocomplete&quot; not found in prototype chain
</del><ins>+PASS HTMLSelectElement interface: document.createElement(&quot;select&quot;) must inherit property &quot;autocomplete&quot; with the proper type (0) 
</ins><span class="cx"> PASS HTMLSelectElement interface: document.createElement(&quot;select&quot;) must inherit property &quot;autofocus&quot; with the proper type (1) 
</span><span class="cx"> PASS HTMLSelectElement interface: document.createElement(&quot;select&quot;) must inherit property &quot;disabled&quot; with the proper type (2) 
</span><span class="cx"> PASS HTMLSelectElement interface: document.createElement(&quot;select&quot;) must inherit property &quot;form&quot; with the proper type (3) 
</span><span class="lines">@@ -4590,7 +4594,9 @@
</span><span class="cx"> PASS HTMLTextAreaElement interface object length 
</span><span class="cx"> PASS HTMLTextAreaElement interface: existence and properties of interface prototype object 
</span><span class="cx"> FAIL HTMLTextAreaElement interface: existence and properties of interface prototype object's &quot;constructor&quot; property assert_true: HTMLTextAreaElement.prototype.constructor is not writable expected true got false
</span><del>-FAIL HTMLTextAreaElement interface: attribute autocomplete assert_true: The prototype object must have a property &quot;autocomplete&quot; expected true got false
</del><ins>+FAIL HTMLTextAreaElement interface: attribute autocomplete assert_throws: getting property on prototype object must throw TypeError function &quot;function () {
+    [native code]
+}&quot; did not throw
</ins><span class="cx"> FAIL HTMLTextAreaElement interface: attribute autofocus assert_throws: getting property on prototype object must throw TypeError function &quot;function () {
</span><span class="cx">     [native code]
</span><span class="cx"> }&quot; did not throw
</span><span class="lines">@@ -4671,7 +4677,7 @@
</span><span class="cx"> FAIL HTMLTextAreaElement interface: operation setSelectionRange(unsigned long,unsigned long,DOMString) assert_equals: property has wrong .length expected 2 but got 0
</span><span class="cx"> PASS HTMLTextAreaElement must be primary interface of document.createElement(&quot;textarea&quot;) 
</span><span class="cx"> PASS Stringification of document.createElement(&quot;textarea&quot;) 
</span><del>-FAIL HTMLTextAreaElement interface: document.createElement(&quot;textarea&quot;) must inherit property &quot;autocomplete&quot; with the proper type (0) assert_inherits: property &quot;autocomplete&quot; not found in prototype chain
</del><ins>+PASS HTMLTextAreaElement interface: document.createElement(&quot;textarea&quot;) must inherit property &quot;autocomplete&quot; with the proper type (0) 
</ins><span class="cx"> PASS HTMLTextAreaElement interface: document.createElement(&quot;textarea&quot;) must inherit property &quot;autofocus&quot; with the proper type (1) 
</span><span class="cx"> PASS HTMLTextAreaElement interface: document.createElement(&quot;textarea&quot;) must inherit property &quot;cols&quot; with the proper type (2) 
</span><span class="cx"> PASS HTMLTextAreaElement interface: document.createElement(&quot;textarea&quot;) must inherit property &quot;dirName&quot; with the proper type (3) 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsemanticsformstheformelementformautocompleteexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-autocomplete-expected.txt (191980 => 191981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-autocomplete-expected.txt        2015-11-03 22:24:14 UTC (rev 191980)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-autocomplete-expected.txt        2015-11-03 22:51:52 UTC (rev 191981)
</span><span class="lines">@@ -20,8 +20,8 @@
</span><span class="cx"> PASS address-line1 is an allowed autocomplete field name 
</span><span class="cx"> PASS address-line2 is an allowed autocomplete field name 
</span><span class="cx"> PASS address-line3 is an allowed autocomplete field name 
</span><del>-PASS locality is an allowed autocomplete field name 
-PASS region is an allowed autocomplete field name 
</del><ins>+FAIL locality is an allowed autocomplete field name assert_equals: expected &quot;locality&quot; but got &quot;&quot;
+FAIL region is an allowed autocomplete field name assert_equals: expected &quot;region&quot; but got &quot;&quot;
</ins><span class="cx"> PASS country is an allowed autocomplete field name 
</span><span class="cx"> PASS country-name is an allowed autocomplete field name 
</span><span class="cx"> PASS postal-code is an allowed autocomplete field name 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (191980 => 191981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-11-03 22:24:14 UTC (rev 191980)
+++ trunk/Source/WebCore/ChangeLog        2015-11-03 22:51:52 UTC (rev 191981)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2015-10-30  Jon Honeycutt  &lt;jhoneycutt@apple.com&gt;
+
+        Implement support for the autocomplete attribute
+        https://bugs.webkit.org/show_bug.cgi?id=150731
+        rdar://problem/21078968
+
+        The autocomplete attribute is defined by
+        https://html.spec.whatwg.org/multipage/forms.html#autofill.
+
+        Reviewed by Brent Fulgham.
+
+        Test: fast/forms/autocomplete-tokens.html
+
+        * html/HTMLFormControlElement.cpp:
+        (WebCore::isContactToken):
+        Return true if this is a contact token.
+        (WebCore::categoryForAutofillFieldToken):
+        Adds all of the autofill field tokens to a map, and returns the
+        category for a given token.
+        (WebCore::maxTokensForAutofillFieldCategory):
+        Return the maximum number of tokens an autofill category supports.
+        (WebCore::HTMLFormControlElement::parseAutocompleteAttribute):
+        Implement the processing model defined in
+        https://html.spec.whatwg.org/multipage/forms.html#processing-model-3
+        with respect to the IDL-exposed autofill value.
+        (WebCore::HTMLFormControlElement::setAutocomplete):
+        Set the autocomplete attribute to the given string.
+
+        * html/HTMLFormControlElement.h:
+        Declare setAutocomplete() and autocomplete().
+
+        * html/HTMLInputElement.idl:
+        Remove the Reflect attribute. We now have custom processing for getting
+        this attribute.
+
+        * html/HTMLSelectElement.idl:
+        Declare the autocomplete attribute.
+
+        * html/HTMLTextAreaElement.idl:
+        Ditto.
+
</ins><span class="cx"> 2015-11-03  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Modern IDB: Land empty IDBCursor/Index IDL implementations.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLFormControlElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLFormControlElement.cpp (191980 => 191981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLFormControlElement.cpp        2015-11-03 22:24:14 UTC (rev 191980)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.cpp        2015-11-03 22:51:52 UTC (rev 191981)
</span><span class="lines">@@ -594,4 +594,163 @@
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static inline bool isContactToken(const AtomicString&amp; token)
+{
+    return token == &quot;home&quot; || token == &quot;work&quot; || token == &quot;mobile&quot; || token == &quot;fax&quot; || token == &quot;pager&quot;;
+}
+
+enum class AutofillCategory {
+    Invalid,
+    Off,
+    Automatic,
+    Normal,
+    Contact,
+};
+
+static inline AutofillCategory categoryForAutofillFieldToken(const AtomicString&amp; token)
+{
+    static NeverDestroyed&lt;HashMap&lt;AtomicString, AutofillCategory&gt;&gt; map;
+    if (map.get().isEmpty()) {
+        map.get().add(AtomicString(&quot;off&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Off);
+        map.get().add(AtomicString(&quot;on&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Automatic);
+
+        map.get().add(AtomicString(&quot;name&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;honorific-prefix&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;given-name&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;additional-name&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;family-name&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;honorific-suffix&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;nickname&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;username&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;new-password&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;current-password&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;organization-title&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;organization&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;street-address&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;address-line1&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;address-line2&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;address-line3&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;address-level4&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;address-level3&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;address-level2&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;address-level1&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;country&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;country-name&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;postal-code&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;cc-name&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;cc-given-name&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;cc-additional-name&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;cc-family-name&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;cc-number&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;cc-exp&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;cc-exp-month&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;cc-exp-year&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;cc-csc&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;cc-type&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;transaction-currency&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;transaction-amount&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;language&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;bday&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;bday-day&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;bday-month&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;bday-year&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;sex&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;url&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+        map.get().add(AtomicString(&quot;photo&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Normal);
+
+        map.get().add(AtomicString(&quot;tel&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Contact);
+        map.get().add(AtomicString(&quot;tel-country-code&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Contact);
+        map.get().add(AtomicString(&quot;tel-national&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Contact);
+        map.get().add(AtomicString(&quot;tel-area-code&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Contact);
+        map.get().add(AtomicString(&quot;tel-local&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Contact);
+        map.get().add(AtomicString(&quot;tel-local-prefix&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Contact);
+        map.get().add(AtomicString(&quot;tel-local-suffix&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Contact);
+        map.get().add(AtomicString(&quot;tel-extension&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Contact);
+        map.get().add(AtomicString(&quot;email&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Contact);
+        map.get().add(AtomicString(&quot;impp&quot;, AtomicString::ConstructFromLiteral), AutofillCategory::Contact);
+    }
+
+    return map.get().get(token);
+}
+
+static inline unsigned maxTokensForAutofillFieldCategory(AutofillCategory category)
+{
+    switch (category) {
+    case AutofillCategory::Invalid:
+        return 0;
+
+    case AutofillCategory::Automatic:
+    case AutofillCategory::Off:
+        return 1;
+
+    case AutofillCategory::Normal:
+        return 3;
+
+    case AutofillCategory::Contact:
+        return 4;
+    }
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
+// https://html.spec.whatwg.org/multipage/forms.html#processing-model-3
+String HTMLFormControlElement::autocomplete() const
+{
+    const AtomicString&amp; attributeValue = fastGetAttribute(autocompleteAttr);
+    SpaceSplitString tokens(attributeValue, true);
+    if (tokens.isEmpty())
+        return String();
+
+    size_t currentTokenIndex = tokens.size() - 1;
+    const auto&amp; fieldToken = tokens[currentTokenIndex];
+    auto category = categoryForAutofillFieldToken(fieldToken);
+    if (category == AutofillCategory::Invalid)
+        return String();
+
+    if (tokens.size() &gt; maxTokensForAutofillFieldCategory(category))
+        return String();
+
+    bool wearingAutofillAnchorMantle = is&lt;HTMLInputElement&gt;(*this) &amp;&amp; downcast&lt;HTMLInputElement&gt;(this)-&gt;isInputTypeHidden();
+    if ((category == AutofillCategory::Off || category == AutofillCategory::Automatic) &amp;&amp; wearingAutofillAnchorMantle)
+        return String();
+
+    if (category == AutofillCategory::Off)
+        return ASCIILiteral(&quot;off&quot;);
+
+    if (category == AutofillCategory::Automatic)
+        return ASCIILiteral(&quot;on&quot;);
+
+    String result = fieldToken;
+    if (!currentTokenIndex--)
+        return result;
+
+    const auto&amp; contactToken = tokens[currentTokenIndex];
+    if (category == AutofillCategory::Contact &amp;&amp; isContactToken(contactToken)) {
+        result = contactToken + &quot; &quot; + result;
+        if (!currentTokenIndex--)
+            return result;
+    }
+
+    const auto&amp; modeToken = tokens[currentTokenIndex];
+    if (modeToken == &quot;shipping&quot; || modeToken == &quot;billing&quot;) {
+        result = modeToken + &quot; &quot; + result;
+        if (!currentTokenIndex--)
+            return result;
+    }
+
+    if (currentTokenIndex)
+        return String();
+
+    const auto&amp; sectionToken = tokens[currentTokenIndex];
+    if (!sectionToken.startsWith(&quot;section-&quot;))
+        return String();
+
+    return sectionToken + &quot; &quot; + result;
+}
+
+void HTMLFormControlElement::setAutocomplete(const String&amp; value)
+{
+    setAttribute(autocompleteAttr, value);
+}
+
</ins><span class="cx"> } // namespace Webcore
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLFormControlElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLFormControlElement.h (191980 => 191981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLFormControlElement.h        2015-11-03 22:24:14 UTC (rev 191980)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.h        2015-11-03 22:51:52 UTC (rev 191981)
</span><span class="lines">@@ -114,6 +114,9 @@
</span><span class="cx"> 
</span><span class="cx">     static HTMLFormControlElement* enclosingFormControlElement(Node*);
</span><span class="cx"> 
</span><ins>+    String autocomplete() const;
+    void setAutocomplete(const String&amp;);
+
</ins><span class="cx">     using Node::ref;
</span><span class="cx">     using Node::deref;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLInputElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLInputElement.idl (191980 => 191981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLInputElement.idl        2015-11-03 22:24:14 UTC (rev 191980)
+++ trunk/Source/WebCore/html/HTMLInputElement.idl        2015-11-03 22:51:52 UTC (rev 191981)
</span><span class="lines">@@ -22,7 +22,7 @@
</span><span class="cx"> interface HTMLInputElement : HTMLElement {
</span><span class="cx">     [Reflect] attribute DOMString accept;
</span><span class="cx">     [Reflect] attribute DOMString alt;
</span><del>-    [Reflect] attribute DOMString autocomplete;
</del><ins>+    attribute DOMString autocomplete;
</ins><span class="cx">     [Reflect] attribute boolean autofocus;
</span><span class="cx">     [Reflect=checked] attribute boolean defaultChecked;
</span><span class="cx">     attribute boolean checked;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLSelectElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLSelectElement.idl (191980 => 191981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLSelectElement.idl        2015-11-03 22:24:14 UTC (rev 191980)
+++ trunk/Source/WebCore/html/HTMLSelectElement.idl        2015-11-03 22:51:52 UTC (rev 191981)
</span><span class="lines">@@ -68,4 +68,6 @@
</span><span class="cx">     void setCustomValidity([TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error);
</span><span class="cx"> 
</span><span class="cx">     readonly attribute NodeList labels;
</span><ins>+
+    attribute DOMString autocomplete;
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTextAreaElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTextAreaElement.idl (191980 => 191981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTextAreaElement.idl        2015-11-03 22:24:14 UTC (rev 191980)
+++ trunk/Source/WebCore/html/HTMLTextAreaElement.idl        2015-11-03 22:51:52 UTC (rev 191981)
</span><span class="lines">@@ -71,4 +71,6 @@
</span><span class="cx"> #if defined(LANGUAGE_OBJECTIVE_C) &amp;&amp; LANGUAGE_OBJECTIVE_C
</span><span class="cx">     [Reflect] attribute DOMString accessKey;
</span><span class="cx"> #endif
</span><ins>+
+    attribute DOMString autocomplete;
</ins><span class="cx"> };
</span></span></pre>
</div>
</div>

</body>
</html>