<!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>[206560] 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/206560">206560</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2016-09-28 16:34:54 -0700 (Wed, 28 Sep 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>DOMTokenList’s value and stringifier should not return parsed tokens
https://bugs.webkit.org/show_bug.cgi?id=161076
Reviewed by Chris Dumez.
LayoutTests/imported/w3c:
Rebaselined tests that are now passing.
* web-platform-tests/dom/lists/DOMTokenList-stringifier-expected.txt:
* web-platform-tests/dom/lists/DOMTokenList-value-expected.txt:
* web-platform-tests/dom/nodes/Element-classlist-expected.txt:
Source/WebCore:
Updated our implementation of DOMTokenList.prototype.value and its toString function
to match the latest DOM specification: https://dom.spec.whatwg.org/#interface-domtokenlist
"value" attribute, on getting, runs its serialize steps, which simply gets the attribute value.
On setting, it sets the attribute value with the given value.
The stringification behavior returns the same serialize steps as "value" attribute on getting.
This change simplifies our implementation of DOMTokenList and removes the need for m_cachedValue,
which has been removed in this patch.
No new tests since existing tests cover this.
* html/DOMTokenList.cpp:
(WebCore::DOMTokenList::value): Just call getAttribute.
(WebCore::DOMTokenList::setValue): Just call setAttribute.
(WebCore::DOMTokenList::updateTokensFromAttributeValue):
(WebCore::DOMTokenList::associatedAttributeValueChanged):
(WebCore::DOMTokenList::updateAssociatedAttributeFromTokens): Moved the code to update the tokens
from from the attribute value. This is the "update steps".
* html/DOMTokenList.h:
LayoutTests:
Added more test cases and rebaselined tests. Most of changes are due to the change that DOMTokenList's value
and stringifier now returns the original attribute value with extra whitespaces.
* fast/dom/HTMLLinkElement/sizes-setter-expected.txt:
* fast/dom/HTMLLinkElement/sizes-setter.html:
* fast/dom/HTMLOutputElement/dom-settable-token-list-expected.txt:
* fast/dom/HTMLOutputElement/htmloutputelement-expected.txt:
* fast/dom/HTMLOutputElement/htmloutputelement.html:
* fast/dom/HTMLOutputElement/script-tests/dom-settable-token-list.js:
* fast/frames/sandbox-attribute-expected.txt:
* fast/frames/sandbox-attribute.html:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLLinkElementsizessetterexpectedtxt">trunk/LayoutTests/fast/dom/HTMLLinkElement/sizes-setter-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLLinkElementsizessetterhtml">trunk/LayoutTests/fast/dom/HTMLLinkElement/sizes-setter.html</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLOutputElementdomsettabletokenlistexpectedtxt">trunk/LayoutTests/fast/dom/HTMLOutputElement/dom-settable-token-list-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLOutputElementhtmloutputelementexpectedtxt">trunk/LayoutTests/fast/dom/HTMLOutputElement/htmloutputelement-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLOutputElementhtmloutputelementhtml">trunk/LayoutTests/fast/dom/HTMLOutputElement/htmloutputelement.html</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLOutputElementscripttestsdomsettabletokenlistjs">trunk/LayoutTests/fast/dom/HTMLOutputElement/script-tests/dom-settable-token-list.js</a></li>
<li><a href="#trunkLayoutTestsfastframessandboxattributeexpectedtxt">trunk/LayoutTests/fast/frames/sandbox-attribute-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastframessandboxattributehtml">trunk/LayoutTests/fast/frames/sandbox-attribute.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsdomlistsDOMTokenListstringifierexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/dom/lists/DOMTokenList-stringifier-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsdomlistsDOMTokenListvalueexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/dom/lists/DOMTokenList-value-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsdomnodesElementclasslistexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-classlist-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlDOMTokenListcpp">trunk/Source/WebCore/html/DOMTokenList.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlDOMTokenListh">trunk/Source/WebCore/html/DOMTokenList.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (206559 => 206560)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-09-28 23:22:57 UTC (rev 206559)
+++ trunk/LayoutTests/ChangeLog        2016-09-28 23:34:54 UTC (rev 206560)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2016-09-28 Ryosuke Niwa <rniwa@webkit.org>
+
+ DOMTokenList’s value and stringifier should not return parsed tokens
+ https://bugs.webkit.org/show_bug.cgi?id=161076
+
+ Reviewed by Chris Dumez.
+
+ Added more test cases and rebaselined tests. Most of changes are due to the change that DOMTokenList's value
+ and stringifier now returns the original attribute value with extra whitespaces.
+
+ * fast/dom/HTMLLinkElement/sizes-setter-expected.txt:
+ * fast/dom/HTMLLinkElement/sizes-setter.html:
+ * fast/dom/HTMLOutputElement/dom-settable-token-list-expected.txt:
+ * fast/dom/HTMLOutputElement/htmloutputelement-expected.txt:
+ * fast/dom/HTMLOutputElement/htmloutputelement.html:
+ * fast/dom/HTMLOutputElement/script-tests/dom-settable-token-list.js:
+ * fast/frames/sandbox-attribute-expected.txt:
+ * fast/frames/sandbox-attribute.html:
+
</ins><span class="cx"> 2016-09-28 Ryan Haddad <ryanhaddad@apple.com>
</span><span class="cx">
</span><span class="cx"> Marking fast/images/animated-gif-restored-from-bfcache.html as flaky on mac-wk2 debug.
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLLinkElementsizessetterexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLLinkElement/sizes-setter-expected.txt (206559 => 206560)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLLinkElement/sizes-setter-expected.txt        2016-09-28 23:22:57 UTC (rev 206559)
+++ trunk/LayoutTests/fast/dom/HTMLLinkElement/sizes-setter-expected.txt        2016-09-28 23:34:54 UTC (rev 206560)
</span><span class="lines">@@ -5,8 +5,11 @@
</span><span class="cx">
</span><span class="cx"> PASS link.sizes.__proto__ is DOMTokenList.prototype
</span><span class="cx"> link.sizes = '10x10 20x20'
</span><del>-PASS String(link.sizes) is "10x10 20x20"
-PASS link.getAttribute('sizes') is "10x10 20x20"
</del><ins>+PASS String(link.sizes) is "10x10 20x20"
+PASS link.getAttribute('sizes') is "10x10 20x20"
+link.sizes.add('30x30')
+PASS String(link.sizes) is "10x10 20x20 30x30"
+PASS link.getAttribute('sizes') is "10x10 20x20 30x30"
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLLinkElementsizessetterhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLLinkElement/sizes-setter.html (206559 => 206560)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLLinkElement/sizes-setter.html        2016-09-28 23:22:57 UTC (rev 206559)
+++ trunk/LayoutTests/fast/dom/HTMLLinkElement/sizes-setter.html        2016-09-28 23:34:54 UTC (rev 206560)
</span><span class="lines">@@ -8,8 +8,11 @@
</span><span class="cx"> var link = document.createElement("link");
</span><span class="cx"> shouldBe("link.sizes.__proto__", "DOMTokenList.prototype");
</span><span class="cx"> evalAndLog("link.sizes = '10x10 20x20'");
</span><del>-shouldBeEqualToString("String(link.sizes)", "10x10 20x20");
-shouldBeEqualToString("link.getAttribute('sizes')", "10x10 20x20");
</del><ins>+shouldBeEqualToString("String(link.sizes)", "10x10 20x20");
+shouldBeEqualToString("link.getAttribute('sizes')", "10x10 20x20");
+evalAndLog("link.sizes.add('30x30')");
+shouldBeEqualToString("String(link.sizes)", "10x10 20x20 30x30");
+shouldBeEqualToString("link.getAttribute('sizes')", "10x10 20x20 30x30");
</ins><span class="cx"> </script>
</span><span class="cx"> <script src="../../../resources/js-test-post.js"></script>
</span><span class="cx"> </body>
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLOutputElementdomsettabletokenlistexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLOutputElement/dom-settable-token-list-expected.txt (206559 => 206560)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLOutputElement/dom-settable-token-list-expected.txt        2016-09-28 23:22:57 UTC (rev 206559)
+++ trunk/LayoutTests/fast/dom/HTMLOutputElement/dom-settable-token-list-expected.txt        2016-09-28 23:34:54 UTC (rev 206560)
</span><span class="lines">@@ -5,8 +5,9 @@
</span><span class="cx">
</span><span class="cx"> - Tests from http://simon.html5.org/test/html/dom/reflecting/DOMTokenList/
</span><span class="cx"> PASS element.htmlFor.__proto__ is DOMTokenList.prototype
</span><del>-PASS String(element.htmlFor) is "y z"
-PASS element.getAttribute("for") is "y z"
</del><ins>+PASS String(element.htmlFor) is "y z"
+PASS element.htmlFor.value is "y z"
+PASS element.getAttribute("for") is "y z"
</ins><span class="cx"> PASS String(element.htmlFor) is "r s t"
</span><span class="cx"> PASS element.htmlFor.length is 0
</span><span class="cx"> PASS element.htmlFor.length is 1
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLOutputElementhtmloutputelementexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLOutputElement/htmloutputelement-expected.txt (206559 => 206560)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLOutputElement/htmloutputelement-expected.txt        2016-09-28 23:22:57 UTC (rev 206559)
+++ trunk/LayoutTests/fast/dom/HTMLOutputElement/htmloutputelement-expected.txt        2016-09-28 23:34:54 UTC (rev 206560)
</span><span class="lines">@@ -8,11 +8,13 @@
</span><span class="cx"> PASS output1.value is "A value"
</span><span class="cx"> PASS output2.htmlFor.length is 1
</span><span class="cx"> PASS output2.htmlFor[0] is "for-target1"
</span><ins>+PASS String(output2.htmlFor) is "for-target1"
</ins><span class="cx"> PASS output2.htmlFor.value is "for-target1"
</span><span class="cx"> PASS output3.htmlFor.length is 2
</span><span class="cx"> PASS output3.htmlFor[0] is "for-target1"
</span><span class="cx"> PASS output3.htmlFor[1] is "for-target2"
</span><del>-PASS output3.htmlFor.value is "for-target1 for-target2"
</del><ins>+PASS String(output3.htmlFor) is " for-target1 for-target2 "
+PASS output3.htmlFor.value is " for-target1 for-target2 "
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLOutputElementhtmloutputelementhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLOutputElement/htmloutputelement.html (206559 => 206560)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLOutputElement/htmloutputelement.html        2016-09-28 23:22:57 UTC (rev 206559)
+++ trunk/LayoutTests/fast/dom/HTMLOutputElement/htmloutputelement.html        2016-09-28 23:34:54 UTC (rev 206560)
</span><span class="lines">@@ -23,12 +23,14 @@
</span><span class="cx">
</span><span class="cx"> shouldEvaluateTo('output2.htmlFor.length', 1);
</span><span class="cx"> shouldBeEqualToString('output2.htmlFor[0]', 'for-target1');
</span><ins>+shouldBeEqualToString('String(output2.htmlFor)', 'for-target1');
</ins><span class="cx"> shouldBeEqualToString('output2.htmlFor.value', 'for-target1');
</span><span class="cx">
</span><span class="cx"> shouldEvaluateTo('output3.htmlFor.length', 2);
</span><span class="cx"> shouldBeEqualToString('output3.htmlFor[0]', 'for-target1');
</span><span class="cx"> shouldBeEqualToString('output3.htmlFor[1]', 'for-target2');
</span><del>-shouldBeEqualToString('output3.htmlFor.value', 'for-target1 for-target2');
</del><ins>+shouldBeEqualToString('String(output3.htmlFor)', ' for-target1 for-target2 ');
+shouldBeEqualToString('output3.htmlFor.value', ' for-target1 for-target2 ');
</ins><span class="cx"> </script>
</span><span class="cx"> <script src="../../../resources/js-test-post.js"></script>
</span><span class="cx"> </body>
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLOutputElementscripttestsdomsettabletokenlistjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/HTMLOutputElement/script-tests/dom-settable-token-list.js (206559 => 206560)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLOutputElement/script-tests/dom-settable-token-list.js        2016-09-28 23:22:57 UTC (rev 206559)
+++ trunk/LayoutTests/fast/dom/HTMLOutputElement/script-tests/dom-settable-token-list.js        2016-09-28 23:34:54 UTC (rev 206560)
</span><span class="lines">@@ -18,8 +18,9 @@
</span><span class="cx"> createElement('x');
</span><span class="cx"> shouldBe('element.htmlFor.__proto__', 'DOMTokenList.prototype');
</span><span class="cx"> element.htmlFor = 'y z';
</span><del>-shouldBeEqualToString('String(element.htmlFor)', 'y z');
-shouldBeEqualToString('element.getAttribute("for")', 'y z');
</del><ins>+shouldBeEqualToString('String(element.htmlFor)', 'y z');
+shouldBeEqualToString('element.htmlFor.value', 'y z');
+shouldBeEqualToString('element.getAttribute("for")', 'y z');
</ins><span class="cx"> element.setAttribute('for', 'r s t');
</span><span class="cx"> shouldBeEqualToString('String(element.htmlFor)', 'r s t');
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsfastframessandboxattributeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/frames/sandbox-attribute-expected.txt (206559 => 206560)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/frames/sandbox-attribute-expected.txt        2016-09-28 23:22:57 UTC (rev 206559)
+++ trunk/LayoutTests/fast/frames/sandbox-attribute-expected.txt        2016-09-28 23:34:54 UTC (rev 206560)
</span><span class="lines">@@ -10,8 +10,8 @@
</span><span class="cx"> PASS iframe.sandbox[0] is "allow-popups"
</span><span class="cx"> PASS iframe.sandbox[1] is "allow-scripts"
</span><span class="cx"> PASS iframe.sandbox[2] is "allow-same-origin"
</span><del>-PASS String(iframe.sandbox) is "allow-popups allow-scripts allow-same-origin"
-PASS iframe.getAttribute('sandbox') is "allow-popups allow-scripts allow-same-origin"
</del><ins>+PASS String(iframe.sandbox) is "allow-popups allow-scripts allow-scripts allow-same-origin"
+PASS iframe.getAttribute('sandbox') is "allow-popups allow-scripts allow-scripts allow-same-origin"
</ins><span class="cx">
</span><span class="cx"> iframe.setAttribute('sandbox', 'allow-popups allow-scripts')
</span><span class="cx"> PASS iframe.sandbox.length is 2
</span></span></pre></div>
<a id="trunkLayoutTestsfastframessandboxattributehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/frames/sandbox-attribute.html (206559 => 206560)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/frames/sandbox-attribute.html        2016-09-28 23:22:57 UTC (rev 206559)
+++ trunk/LayoutTests/fast/frames/sandbox-attribute.html        2016-09-28 23:34:54 UTC (rev 206560)
</span><span class="lines">@@ -14,8 +14,8 @@
</span><span class="cx"> shouldBeEqualToString("iframe.sandbox[0]", "allow-popups");
</span><span class="cx"> shouldBeEqualToString("iframe.sandbox[1]", "allow-scripts");
</span><span class="cx"> shouldBeEqualToString("iframe.sandbox[2]", "allow-same-origin");
</span><del>-shouldBeEqualToString("String(iframe.sandbox)", "allow-popups allow-scripts allow-same-origin");
-shouldBeEqualToString("iframe.getAttribute('sandbox')", "allow-popups allow-scripts allow-same-origin");
</del><ins>+shouldBeEqualToString("String(iframe.sandbox)", "allow-popups allow-scripts allow-scripts allow-same-origin");
+shouldBeEqualToString("iframe.getAttribute('sandbox')", 'allow-popups allow-scripts allow-scripts allow-same-origin');
</ins><span class="cx">
</span><span class="cx"> debug("");
</span><span class="cx"> evalAndLog("iframe.setAttribute('sandbox', 'allow-popups allow-scripts')");
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (206559 => 206560)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-09-28 23:22:57 UTC (rev 206559)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-09-28 23:34:54 UTC (rev 206560)
</span><span class="lines">@@ -1,5 +1,18 @@
</span><span class="cx"> 2016-09-28 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><ins>+ DOMTokenList’s value and stringifier should not return parsed tokens
+ https://bugs.webkit.org/show_bug.cgi?id=161076
+
+ Reviewed by Chris Dumez.
+
+ Rebaselined tests that are now passing.
+
+ * web-platform-tests/dom/lists/DOMTokenList-stringifier-expected.txt:
+ * web-platform-tests/dom/lists/DOMTokenList-value-expected.txt:
+ * web-platform-tests/dom/nodes/Element-classlist-expected.txt:
+
+2016-09-28 Ryosuke Niwa <rniwa@webkit.org>
+
</ins><span class="cx"> assignedNodes should include fallback contents when flattened option is set
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=162656
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsdomlistsDOMTokenListstringifierexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/lists/DOMTokenList-stringifier-expected.txt (206559 => 206560)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/lists/DOMTokenList-stringifier-expected.txt        2016-09-28 23:22:57 UTC (rev 206559)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/lists/DOMTokenList-stringifier-expected.txt        2016-09-28 23:34:54 UTC (rev 206560)
</span><span class="lines">@@ -1,3 +1,3 @@
</span><span class="cx">
</span><del>-FAIL DOMTokenList stringifier assert_equals: String(classList) should return the literal value expected " a a b " but got "a b"
</del><ins>+PASS DOMTokenList stringifier
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsdomlistsDOMTokenListvalueexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/lists/DOMTokenList-value-expected.txt (206559 => 206560)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/lists/DOMTokenList-value-expected.txt        2016-09-28 23:22:57 UTC (rev 206559)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/lists/DOMTokenList-value-expected.txt        2016-09-28 23:34:54 UTC (rev 206560)
</span><span class="lines">@@ -1,3 +1,3 @@
</span><span class="cx">
</span><del>-FAIL DOMTokenList value assert_equals: value should return the literal value expected " a a b " but got "a b"
</del><ins>+PASS DOMTokenList value
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsdomnodesElementclasslistexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-classlist-expected.txt (206559 => 206560)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-classlist-expected.txt        2016-09-28 23:22:57 UTC (rev 206559)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-classlist-expected.txt        2016-09-28 23:34:54 UTC (rev 206560)
</span><span class="lines">@@ -13,7 +13,7 @@
</span><span class="cx"> PASS classList[index] must be undefined for out-of-range index
</span><span class="cx"> PASS classList[index] must be undefined for negative index
</span><span class="cx"> PASS className should contain initial markup whitespace
</span><del>-FAIL classList should contain initial markup whitespace assert_equals: implicit expected " " but got ""
</del><ins>+PASS classList should contain initial markup whitespace
</ins><span class="cx"> PASS .contains(empty_string) must return false
</span><span class="cx"> PASS .add(empty_string) must throw a SYNTAX_ERR
</span><span class="cx"> PASS .remove(empty_string) must throw a SYNTAX_ERR
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (206559 => 206560)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-09-28 23:22:57 UTC (rev 206559)
+++ trunk/Source/WebCore/ChangeLog        2016-09-28 23:34:54 UTC (rev 206560)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2016-09-28 Ryosuke Niwa <rniwa@webkit.org>
+
+ DOMTokenList’s value and stringifier should not return parsed tokens
+ https://bugs.webkit.org/show_bug.cgi?id=161076
+
+ Reviewed by Chris Dumez.
+
+ Updated our implementation of DOMTokenList.prototype.value and its toString function
+ to match the latest DOM specification: https://dom.spec.whatwg.org/#interface-domtokenlist
+
+ "value" attribute, on getting, runs its serialize steps, which simply gets the attribute value.
+ On setting, it sets the attribute value with the given value.
+
+ The stringification behavior returns the same serialize steps as "value" attribute on getting.
+
+ This change simplifies our implementation of DOMTokenList and removes the need for m_cachedValue,
+ which has been removed in this patch.
+
+ No new tests since existing tests cover this.
+
+ * html/DOMTokenList.cpp:
+ (WebCore::DOMTokenList::value): Just call getAttribute.
+ (WebCore::DOMTokenList::setValue): Just call setAttribute.
+ (WebCore::DOMTokenList::updateTokensFromAttributeValue):
+ (WebCore::DOMTokenList::associatedAttributeValueChanged):
+ (WebCore::DOMTokenList::updateAssociatedAttributeFromTokens): Moved the code to update the tokens
+ from from the attribute value. This is the "update steps".
+ * html/DOMTokenList.h:
+
</ins><span class="cx"> 2016-09-28 Jer Noble <jer.noble@apple.com>
</span><span class="cx">
</span><span class="cx"> CRASH at WebCore::CDMSessionAVStreamSession::update + 950
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlDOMTokenListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/DOMTokenList.cpp (206559 => 206560)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/DOMTokenList.cpp        2016-09-28 23:22:57 UTC (rev 206559)
+++ trunk/Source/WebCore/html/DOMTokenList.cpp        2016-09-28 23:34:54 UTC (rev 206560)
</span><span class="lines">@@ -177,27 +177,15 @@
</span><span class="cx"> updateAssociatedAttributeFromTokens();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// https://dom.spec.whatwg.org/#dom-domtokenlist-value
</ins><span class="cx"> const AtomicString& DOMTokenList::value() const
</span><span class="cx"> {
</span><del>- if (m_cachedValue.isNull()) {
- // https://dom.spec.whatwg.org/#concept-ordered-set-serializer
- StringBuilder builder;
- for (auto& token : tokens()) {
- if (!builder.isEmpty())
- builder.append(' ');
- builder.append(token);
- }
- m_cachedValue = builder.toAtomicString();
- ASSERT(!m_cachedValue.isNull());
- }
- ASSERT(!m_tokensNeedUpdating);
- return m_cachedValue;
</del><ins>+ return m_element.getAttribute(m_attributeName);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void DOMTokenList::setValue(const String& value)
</span><span class="cx"> {
</span><del>- updateTokensFromAttributeValue(value);
- updateAssociatedAttributeFromTokens();
</del><ins>+ m_element.setAttribute(m_attributeName, value);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void DOMTokenList::updateTokensFromAttributeValue(const String& value)
</span><span class="lines">@@ -227,7 +215,6 @@
</span><span class="cx">
</span><span class="cx"> m_tokens.shrinkToFit();
</span><span class="cx"> m_tokensNeedUpdating = false;
</span><del>- m_cachedValue = nullAtom;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void DOMTokenList::associatedAttributeValueChanged(const AtomicString&)
</span><span class="lines">@@ -237,7 +224,6 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_tokensNeedUpdating = true;
</span><del>- m_cachedValue = nullAtom;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // https://dom.spec.whatwg.org/#concept-dtl-update
</span><span class="lines">@@ -245,11 +231,17 @@
</span><span class="cx"> {
</span><span class="cx"> ASSERT(!m_tokensNeedUpdating);
</span><span class="cx">
</span><del>- m_cachedValue = nullAtom;
</del><ins>+ // https://dom.spec.whatwg.org/#concept-ordered-set-serializer
+ StringBuilder builder;
+ for (auto& token : tokens()) {
+ if (!builder.isEmpty())
+ builder.append(' ');
+ builder.append(token);
+ }
+ AtomicString serializedValue = builder.toAtomicString();
</ins><span class="cx">
</span><span class="cx"> TemporaryChange<bool> inAttributeUpdate(m_inUpdateAssociatedAttributeFromTokens, true);
</span><del>- m_element.setAttribute(m_attributeName, value());
- ASSERT_WITH_MESSAGE(m_cachedValue, "Calling value() should have cached its results");
</del><ins>+ m_element.setAttribute(m_attributeName, serializedValue);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Vector<AtomicString>& DOMTokenList::tokens()
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlDOMTokenListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/DOMTokenList.h (206559 => 206560)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/DOMTokenList.h        2016-09-28 23:22:57 UTC (rev 206559)
+++ trunk/Source/WebCore/html/DOMTokenList.h        2016-09-28 23:34:54 UTC (rev 206560)
</span><span class="lines">@@ -72,7 +72,6 @@
</span><span class="cx"> bool m_inUpdateAssociatedAttributeFromTokens { false };
</span><span class="cx"> bool m_tokensNeedUpdating { true };
</span><span class="cx"> Vector<AtomicString> m_tokens;
</span><del>- mutable AtomicString m_cachedValue;
</del><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> inline unsigned DOMTokenList::length() const
</span></span></pre>
</div>
</div>
</body>
</html>