<!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>[173697] 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/173697">173697</a></dd>
<dt>Author</dt> <dd>benjamin@webkit.org</dd>
<dt>Date</dt> <dd>2014-09-17 13:01:09 -0700 (Wed, 17 Sep 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>CSS value in whitespace-separated list attribute selector (~=) mishandles tab/newline/etc.
https://bugs.webkit.org/show_bug.cgi?id=136807
Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-09-17
Reviewed by Antti Koivisto.
Source/WebCore:
The spec defines selector lists as token separated by white space.
The definition of white space for CSS Selectors is:
"White space in Selectors consists of the code points SPACE (U+0020),
TAB (U+0009), LINE FEED (U+000A), CARRIAGE RETURN (U+000D), and FORM FEED (U+000C)
can occur in whitespace. Other space-like code points, such as EM SPACE (U+2003)
and IDEOGRAPHIC SPACE (U+3000), are never part of white space."
The old code was only matching SPACE (U+0020) which is buggy. This patch
adds support for the other caracters.
Tests: fast/selectors/attr-list-01.html
fast/selectors/attribute-list-with-whitespace-in-selector.html
fast/selectors/attribute-list-with-whitespace-in-value.html
* css/SelectorChecker.cpp:
(WebCore::attributeValueMatches):
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::constructFragments):
(WebCore::SelectorCompiler::attributeValueSpaceSeparetedListContains):
Add the missing checks.
* html/track/VTTRegion.cpp:
(WebCore::VTTRegion::setRegionSettings):
(WebCore::VTTRegion::parseSettingValue):
* html/track/WebVTTParser.cpp:
(WebCore::WebVTTParser::hasRequiredFileIdentifier):
(WebCore::WebVTTParser::collectTimingsAndSettings):
* html/track/WebVTTParser.h:
While looking for affected code, I discovered WebVTT redefines isHTMLSpace().
I cleaned that code.
Source/WTF:
* wtf/text/AtomicString.h:
(WTF::AtomicString::find):
LayoutTests:
* fast/selectors/attr-list-01-expected.html: Added.
* fast/selectors/attr-list-01.html: Added.
This test is from a similar fix from Opera for the blink fork.
Review URL: https://chromiumcodereview.appspot.com/14980012
No other part of that patch is included.
* fast/selectors/attribute-list-with-whitespace-in-selector-expected.txt: Added.
* fast/selectors/attribute-list-with-whitespace-in-selector.html: Added.
Test whitespace characters in the selector itself.
* fast/selectors/attribute-list-with-whitespace-in-value-expected.txt: Added.
* fast/selectors/attribute-list-with-whitespace-in-value.html: Added.
Test whitespace characters in the attribute value.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtftextAtomicStringh">trunk/Source/WTF/wtf/text/AtomicString.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssSelectorCheckercpp">trunk/Source/WebCore/css/SelectorChecker.cpp</a></li>
<li><a href="#trunkSourceWebCorecssjitSelectorCompilercpp">trunk/Source/WebCore/cssjit/SelectorCompiler.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmltrackVTTRegioncpp">trunk/Source/WebCore/html/track/VTTRegion.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmltrackWebVTTParsercpp">trunk/Source/WebCore/html/track/WebVTTParser.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmltrackWebVTTParserh">trunk/Source/WebCore/html/track/WebVTTParser.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastselectorsattrlist01expectedhtml">trunk/LayoutTests/fast/selectors/attr-list-01-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastselectorsattrlist01html">trunk/LayoutTests/fast/selectors/attr-list-01.html</a></li>
<li><a href="#trunkLayoutTestsfastselectorsattributelistwithwhitespaceinselectorexpectedtxt">trunk/LayoutTests/fast/selectors/attribute-list-with-whitespace-in-selector-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastselectorsattributelistwithwhitespaceinselectorhtml">trunk/LayoutTests/fast/selectors/attribute-list-with-whitespace-in-selector.html</a></li>
<li><a href="#trunkLayoutTestsfastselectorsattributelistwithwhitespaceinvalueexpectedtxt">trunk/LayoutTests/fast/selectors/attribute-list-with-whitespace-in-value-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastselectorsattributelistwithwhitespaceinvaluehtml">trunk/LayoutTests/fast/selectors/attribute-list-with-whitespace-in-value.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (173696 => 173697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-09-17 18:27:42 UTC (rev 173696)
+++ trunk/LayoutTests/ChangeLog        2014-09-17 20:01:09 UTC (rev 173697)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2014-09-17 Benjamin Poulain <bpoulain@apple.com>
+
+ CSS value in whitespace-separated list attribute selector (~=) mishandles tab/newline/etc.
+ https://bugs.webkit.org/show_bug.cgi?id=136807
+
+ Reviewed by Antti Koivisto.
+
+ * fast/selectors/attr-list-01-expected.html: Added.
+ * fast/selectors/attr-list-01.html: Added.
+ This test is from a similar fix from Opera for the blink fork.
+ Review URL: https://chromiumcodereview.appspot.com/14980012
+ No other part of that patch is included.
+
+ * fast/selectors/attribute-list-with-whitespace-in-selector-expected.txt: Added.
+ * fast/selectors/attribute-list-with-whitespace-in-selector.html: Added.
+ Test whitespace characters in the selector itself.
+
+ * fast/selectors/attribute-list-with-whitespace-in-value-expected.txt: Added.
+ * fast/selectors/attribute-list-with-whitespace-in-value.html: Added.
+ Test whitespace characters in the attribute value.
+
</ins><span class="cx"> 2014-09-16 Yusuke Suzuki <utatane.tea@gmail.com>
</span><span class="cx">
</span><span class="cx"> filterRootById accidentally clears inAdjacentChain flag
</span></span></pre></div>
<a id="trunkLayoutTestsfastselectorsattrlist01expectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/attr-list-01-expected.html (0 => 173697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/attr-list-01-expected.html         (rev 0)
+++ trunk/LayoutTests/fast/selectors/attr-list-01-expected.html        2014-09-17 20:01:09 UTC (rev 173697)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+<!DOCTYPE html>
+<p style="color:green">This text should be green</span>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsattrlist01html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/attr-list-01.html (0 => 173697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/attr-list-01.html         (rev 0)
+++ trunk/LayoutTests/fast/selectors/attr-list-01.html        2014-09-17 20:01:09 UTC (rev 173697)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Whitespace-separated attribute selectors</title>
+ <style>
+ span { color: red; }
+ [data-list~="b"] { color: green; }
+ #t1:not([data-list~=" z"]) { color: green; }
+ #t2:not([data-list~="u        "]) { color: green; }
+ </style>
+ </head>
+ <body>
+ <p>
+ <span data-list="a        b        ">This</span>
+ <span data-list="a&#10;b&#13;c">text</span>
+ <span data-list="a &#12;b &#12;">should</span>
+ <span id="t1" data-list="w z x&#09;">be</span>
+ <span id="t2" data-list="u&#09;">green</span>
+ </p>
+ </body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsattributelistwithwhitespaceinselectorexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/attribute-list-with-whitespace-in-selector-expected.txt (0 => 173697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/attribute-list-with-whitespace-in-selector-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/selectors/attribute-list-with-whitespace-in-selector-expected.txt        2014-09-17 20:01:09 UTC (rev 173697)
</span><span class="lines">@@ -0,0 +1,73 @@
</span><ins>+When performing attribute matching for space separated values (e.g. [attr~=value]), the selector cannot match anything if the selector's "value" contains a white space. This test check this is true for all the definitions of whitespace of the spec.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.querySelectorAll('[attr~=""]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~=" "]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~="value "]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~=" value"]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~=" value "]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~="        "]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~="value        "]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~="        value"]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~="        value        "]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~="\\0a"]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~="\\0a "]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~="value\\0a"]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~="\\0a value"]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~="\\0a value\\0a"]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~="\\0d"]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~="\\0d "]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~="value\\0d"]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~="\\0d value"]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~="\\0d value\\0d"]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~="\\0c"]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~="\\0c "]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~="value\\0c"]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~="\\0c value"]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~="\\0c value\\0c"]').length is 0
+PASS hasElementStyledBySelector() is false
+PASS document.querySelectorAll('[attr~="\\002003"]').length is 1
+PASS hasElementStyledBySelector() is true
+PASS document.querySelectorAll('[attr~="value\\002003"]').length is 1
+PASS hasElementStyledBySelector() is true
+PASS document.querySelectorAll('[attr~="\\002003 value"]').length is 1
+PASS hasElementStyledBySelector() is true
+PASS document.querySelectorAll('[attr~="\\002003 value\\002003"]').length is 1
+PASS hasElementStyledBySelector() is true
+PASS document.querySelectorAll('[attr~="\\003000"]').length is 1
+PASS hasElementStyledBySelector() is true
+PASS document.querySelectorAll('[attr~="value\\003000"]').length is 1
+PASS hasElementStyledBySelector() is true
+PASS document.querySelectorAll('[attr~="\\003000 value"]').length is 1
+PASS hasElementStyledBySelector() is true
+PASS document.querySelectorAll('[attr~="\\003000 value\\003000"]').length is 1
+PASS hasElementStyledBySelector() is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsattributelistwithwhitespaceinselectorhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/attribute-list-with-whitespace-in-selector.html (0 => 173697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/attribute-list-with-whitespace-in-selector.html         (rev 0)
+++ trunk/LayoutTests/fast/selectors/attribute-list-with-whitespace-in-selector.html        2014-09-17 20:01:09 UTC (rev 173697)
</span><span class="lines">@@ -0,0 +1,154 @@
</span><ins>+<!doctype html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<style id="style-container">
+</style>
+</head>
+<body>
+ <div style="display:none">
+ <!-- Empty -->
+ <target attr=" "></target>
+
+ <!-- Regular spaces. -->
+ <target attr="value"></target>
+ <target attr=" value"></target>
+ <target attr="value "></target>
+ <target attr=" value "></target>
+ <target attr=" value value value "></target>
+
+ <!-- Tabs. -->
+ <target attr="&#9;"></target>
+ <target attr="&#9;value"></target>
+ <target attr="value&#9;"></target>
+ <target attr="&#9;value&#9;"></target>
+ <target attr="&#9;value&#9;value&#9;value&#9;"></target>
+
+ <!-- Line feed. -->
+ <target attr="&#10;"></target>
+ <target attr="&#10;value"></target>
+ <target attr="value&#10;"></target>
+ <target attr="&#10;value&#10;"></target>
+ <target attr="&#10;value&#10;value&#10;value&#10;"></target>
+
+ <!-- Carriage return. -->
+ <target attr="&#13;"></target>
+ <target attr="&#13;value"></target>
+ <target attr="value&#13;"></target>
+ <target attr="&#13;value&#13;"></target>
+ <target attr="&#13;value&#13;value&#13;value&#13;"></target>
+
+ <!-- Carriage return. -->
+ <target attr="&#12;"></target>
+ <target attr="&#12;value"></target>
+ <target attr="value&#12;"></target>
+ <target attr="&#12;value&#12;"></target>
+ <target attr="&#12;value&#12;value&#12;value&#12;"></target>
+
+ <!-- The spec explicitely says EM SPACE (U+2003) and IDEOGRAPHIC SPACE (U+3000) are not whitespace. Let's test for that. -->
+ <!-- EM SPACE (U+2003). -->
+ <target attr="&#x2003"></target>
+ <target attr="&#x2003value"></target>
+ <target attr="value&#x2003"></target>
+ <target attr="&#x2003value&#x2003"></target>
+
+ <!-- IDEOGRAPHIC SPACE (U+3000). -->
+ <target attr="&#x3000"></target>
+ <target attr="&#x3000value"></target>
+ <target attr="value&#x3000"></target>
+ <target attr="&#x3000value&#x3000"></target>
+ </div>
+</body>
+<script>
+description('When performing attribute matching for space separated values (e.g. [attr~=value]), the selector cannot match anything if the selector\'s "value" contains a white space. This test check this is true for all the definitions of whitespace of the spec.');
+
+function hasElementStyledBySelector()
+{
+ var allElements = document.querySelectorAll("*");
+ for (var i = 0; i < allElements.length; ++i) {
+ if (getComputedStyle(allElements[i]).backgroundColor == "rgb(1, 2, 3)")
+ return true;
+ }
+ return false;
+}
+
+function testInvalidSelector(selectorString) {
+ shouldBe('document.querySelectorAll(\'' + selectorString.replace(/\\/g, '\\\\') + '\').length', '0');
+
+ var styleContainer = document.getElementById('style-container');
+ styleContainer.innerHTML = '' + selectorString + ' { background-color: rgb(1, 2, 3); }';
+
+ shouldBeFalse("hasElementStyledBySelector()");
+ styleContainer.innerHTML = '';
+}
+
+var invalidValues = [
+ // Empty.
+ '[attr~=""]',
+
+ // Regular whitespace.
+ '[attr~=" "]',
+ '[attr~="value "]',
+ '[attr~=" value"]',
+ '[attr~=" value "]',
+
+ // Tab.
+ '[attr~="\t"]',
+ '[attr~="value\t"]',
+ '[attr~="\tvalue"]',
+ '[attr~="\tvalue\t"]',
+
+ // Line feed.
+ '[attr~="\\0a"]',
+ '[attr~="\\0a "]',
+ '[attr~="value\\0a"]',
+ '[attr~="\\0a value"]',
+ '[attr~="\\0a value\\0a"]',
+
+ // Carriage return.
+ '[attr~="\\0d"]',
+ '[attr~="\\0d "]',
+ '[attr~="value\\0d"]',
+ '[attr~="\\0d value"]',
+ '[attr~="\\0d value\\0d"]',
+
+ // Form feed.
+ '[attr~="\\0c"]',
+ '[attr~="\\0c "]',
+ '[attr~="value\\0c"]',
+ '[attr~="\\0c value"]',
+ '[attr~="\\0c value\\0c"]',
+];
+
+for (var i = 0; i < invalidValues.length; ++i)
+ testInvalidSelector(invalidValues[i]);
+
+var validValues = [
+ // EM SPACE.
+ '[attr~="\\002003"]',
+ '[attr~="value\\002003"]',
+ '[attr~="\\002003 value"]',
+ '[attr~="\\002003 value\\002003"]',
+
+ // IDEOGRAPHIC SPACE.
+ '[attr~="\\003000"]',
+ '[attr~="value\\003000"]',
+ '[attr~="\\003000 value"]',
+ '[attr~="\\003000 value\\003000"]',
+];
+
+function testValidSelector(selectorString) {
+ shouldBe('document.querySelectorAll(\'' + selectorString.replace(/\\/g, '\\\\') + '\').length', '1');
+
+ var styleContainer = document.getElementById('style-container');
+ styleContainer.innerHTML = '' + selectorString + ' { background-color: rgb(1, 2, 3); }';
+
+ shouldBeTrue("hasElementStyledBySelector()");
+ styleContainer.innerHTML = '';
+}
+
+for (var i = 0; i < validValues.length; ++i)
+ testValidSelector(validValues[i]);
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsattributelistwithwhitespaceinvalueexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/attribute-list-with-whitespace-in-value-expected.txt (0 => 173697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/attribute-list-with-whitespace-in-value-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/selectors/attribute-list-with-whitespace-in-value-expected.txt        2014-09-17 20:01:09 UTC (rev 173697)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+When matching space separated tokens with the attribute selector [attr~=value], any of the following characters can be used as space separator: SPACE (U+0020), TAB (U+0009), LINE FEED (U+000A), CARRIAGE RETURN (U+000D), and FORM FEED (U+000C).
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.querySelectorAll("[attr~=value]").length is document.querySelectorAll("target").length
+PASS document.querySelectorAll("[attr~=value]").length is 21
+PASS document.querySelectorAll("[attr~=value]")[0].tagName is "TARGET"
+PASS document.querySelectorAll("[attr~=value]")[1].tagName is "TARGET"
+PASS document.querySelectorAll("[attr~=value]")[2].tagName is "TARGET"
+PASS document.querySelectorAll("[attr~=value]")[3].tagName is "TARGET"
+PASS document.querySelectorAll("[attr~=value]")[4].tagName is "TARGET"
+PASS document.querySelectorAll("[attr~=value]")[5].tagName is "TARGET"
+PASS document.querySelectorAll("[attr~=value]")[6].tagName is "TARGET"
+PASS document.querySelectorAll("[attr~=value]")[7].tagName is "TARGET"
+PASS document.querySelectorAll("[attr~=value]")[8].tagName is "TARGET"
+PASS document.querySelectorAll("[attr~=value]")[9].tagName is "TARGET"
+PASS document.querySelectorAll("[attr~=value]")[10].tagName is "TARGET"
+PASS document.querySelectorAll("[attr~=value]")[11].tagName is "TARGET"
+PASS document.querySelectorAll("[attr~=value]")[12].tagName is "TARGET"
+PASS document.querySelectorAll("[attr~=value]")[13].tagName is "TARGET"
+PASS document.querySelectorAll("[attr~=value]")[14].tagName is "TARGET"
+PASS document.querySelectorAll("[attr~=value]")[15].tagName is "TARGET"
+PASS document.querySelectorAll("[attr~=value]")[16].tagName is "TARGET"
+PASS document.querySelectorAll("[attr~=value]")[17].tagName is "TARGET"
+PASS document.querySelectorAll("[attr~=value]")[18].tagName is "TARGET"
+PASS document.querySelectorAll("[attr~=value]")[19].tagName is "TARGET"
+PASS document.querySelectorAll("[attr~=value]")[20].tagName is "TARGET"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[0]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[1]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[2]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[3]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[4]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[5]).backgroundColor is "rgb(0, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[6]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[7]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[8]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[9]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[10]).backgroundColor is "rgb(0, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[11]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[12]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[13]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[14]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[15]).backgroundColor is "rgb(0, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[16]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[17]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[18]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[19]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[20]).backgroundColor is "rgb(0, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[21]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[22]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[23]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[24]).backgroundColor is "rgb(1, 2, 3)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[25]).backgroundColor is "rgb(0, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[26]).backgroundColor is "rgb(0, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[27]).backgroundColor is "rgb(0, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[28]).backgroundColor is "rgb(0, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[29]).backgroundColor is "rgb(0, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[30]).backgroundColor is "rgb(0, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[31]).backgroundColor is "rgb(0, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[32]).backgroundColor is "rgb(0, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[33]).backgroundColor is "rgb(0, 0, 0)"
+PASS getComputedStyle(document.querySelectorAll("#testBlock *")[34]).backgroundColor is "rgb(0, 0, 0)"
+PASS document.querySelectorAll("[attr~=\\002003 value]").length is 2
+PASS document.querySelectorAll("[attr~=\\002003 value\\003000]").length is 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastselectorsattributelistwithwhitespaceinvaluehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/selectors/attribute-list-with-whitespace-in-value.html (0 => 173697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/selectors/attribute-list-with-whitespace-in-value.html         (rev 0)
+++ trunk/LayoutTests/fast/selectors/attribute-list-with-whitespace-in-value.html        2014-09-17 20:01:09 UTC (rev 173697)
</span><span class="lines">@@ -0,0 +1,89 @@
</span><ins>+<!doctype html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<style>
+#testBlock * {
+ background-color: black;
+}
+#testBlock [attr~=value] {
+ background-color: rgb(1, 2, 3);
+}
+</style>
+</head>
+<body>
+ <div style="display:none" id="testBlock">
+ <target attr="value"></target>
+
+ <!-- Regular spaces. -->
+ <target attr=" value"></target>
+ <target attr="value "></target>
+ <target attr=" value "></target>
+ <target attr=" value value value "></target>
+
+ <!-- Tabs. -->
+ <invalidTarget attr="&#9;"></invalidTarget>
+ <target attr="&#9;value"></target>
+ <target attr="value&#9;"></target>
+ <target attr="&#9;value&#9;"></target>
+ <target attr="&#9;value1&#9;value&#9;value3&#9;"></target>
+
+ <!-- Line feed. -->
+ <invalidTarget attr="&#10;"></invalidTarget>
+ <target attr="&#10;value"></target>
+ <target attr="value&#10;"></target>
+ <target attr="&#10;value&#10;"></target>
+ <target attr="&#10;value1&#10;value&#10;value3&#10;"></target>
+
+ <!-- Carriage return. -->
+ <invalidTarget attr="&#13;"></invalidTarget>
+ <target attr="&#13;value"></target>
+ <target attr="value&#13;"></target>
+ <target attr="&#13;value&#13;"></target>
+ <target attr="&#13;value1&#13;value&#13;value3&#13;"></target>
+
+ <!-- Carriage return. -->
+ <invalidTarget attr="&#12;"></invalidTarget>
+ <target attr="&#12;value"></target>
+ <target attr="value&#12;"></target>
+ <target attr="&#12;value&#12;"></target>
+ <target attr="&#12;value1&#12;value&#12;value3&#12;"></target>
+
+ <!-- The spec explicitely says EM SPACE (U+2003) and IDEOGRAPHIC SPACE (U+3000) are not whitespace. Let's test for that. -->
+ <!-- EM SPACE (U+2003). -->
+ <invalidTarget attr="&#x2003"></invalidTarget>
+ <emSpaceTarget attr="&#x2003value"></emSpaceTarget>
+ <invalidTarget attr="value&#x2003"></invalidTarget>
+ <invalidTarget attr="&#x2003value1&#x2003value&#x2003value3&#x2003"></invalidTarget>
+ <emSpaceTarget attr="&#x2003value1 &#x2003value2&#9;&#x2003value3&#10;&#x2003value4&#13;&#x2003value5&#12;&#x2003value"></emSpaceTarget>
+
+ <!-- IDEOGRAPHIC SPACE (U+3000). -->
+ <invalidTarget attr="&#x3000"></invalidTarget>
+ <invalidTarget attr="&#x3000value"></invalidTarget>
+ <invalidTarget attr="value&#x3000"></invalidTarget>
+ <invalidTarget attr="&#x3000value1&#x3000value&#x3000value3&#x3000"></invalidTarget>
+ <ideographicSpaceTarget attr="&#x2003value1&#x3000 &#x2003value2&#x3000&#9;&#x2003value3&#x3000&#10;&#x2003value4&#x3000&#13;&#x2003value5&#x3000&#12;&#x2003value&#x3000"></ideographicSpaceTarget>
+ </div>
+</body>
+<script>
+description('When matching space separated tokens with the attribute selector [attr~=value], any of the following characters can be used as space separator: SPACE (U+0020), TAB (U+0009), LINE FEED (U+000A), CARRIAGE RETURN (U+000D), and FORM FEED (U+000C).');
+
+shouldBe('document.querySelectorAll("[attr~=value]").length', 'document.querySelectorAll("target").length');
+shouldBe('document.querySelectorAll("[attr~=value]").length', '' + document.querySelectorAll("target").length); // For result readability.
+
+// Test querySelector.
+var allMatches = document.querySelectorAll("[attr~=value]");
+for (var i = 0; i < allMatches.length; ++i)
+ shouldBeEqualToString('document.querySelectorAll("[attr~=value]")[' + i + '].tagName', 'TARGET');
+
+// Test styling.
+var allTestElements = document.querySelectorAll("#testBlock *");
+for (var i = 0; i < allTestElements.length; ++i)
+ shouldBeEqualToString('getComputedStyle(document.querySelectorAll("#testBlock *")[' + i + ']).backgroundColor', allTestElements[i].tagName === 'TARGET' ? 'rgb(1, 2, 3)' : 'rgb(0, 0, 0)');
+
+// Make sure neither EM SPACE nor IDEOGRAPHIC SPACE get a special value.
+shouldBe('document.querySelectorAll("[attr~=\\\\002003 value]").length', '2');
+shouldBe('document.querySelectorAll("[attr~=\\\\002003 value\\\\003000]").length', '1');
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (173696 => 173697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2014-09-17 18:27:42 UTC (rev 173696)
+++ trunk/Source/WTF/ChangeLog        2014-09-17 20:01:09 UTC (rev 173697)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2014-09-17 Benjamin Poulain <bpoulain@apple.com>
+
+ CSS value in whitespace-separated list attribute selector (~=) mishandles tab/newline/etc.
+ https://bugs.webkit.org/show_bug.cgi?id=136807
+
+ Reviewed by Antti Koivisto.
+
+ * wtf/text/AtomicString.h:
+ (WTF::AtomicString::find):
+
</ins><span class="cx"> 2014-09-17 Daniel Bates <dabates@apple.com>
</span><span class="cx">
</span><span class="cx"> [iOS] Make WebCore build with public iOS SDK
</span></span></pre></div>
<a id="trunkSourceWTFwtftextAtomicStringh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/text/AtomicString.h (173696 => 173697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/text/AtomicString.h        2014-09-17 18:27:42 UTC (rev 173696)
+++ trunk/Source/WTF/wtf/text/AtomicString.h        2014-09-17 20:01:09 UTC (rev 173697)
</span><span class="lines">@@ -123,7 +123,9 @@
</span><span class="cx"> { return m_string.find(s, start, caseSentitive); }
</span><span class="cx"> size_t find(const String& s, unsigned start = 0, bool caseSentitive = true) const
</span><span class="cx"> { return m_string.find(s, start, caseSentitive); }
</span><del>-
</del><ins>+ size_t find(CharacterMatchFunctionPtr matchFunction, unsigned start = 0) const
+ { return m_string.find(matchFunction, start); }
+
</ins><span class="cx"> bool startsWith(const String& s, bool caseSensitive = true) const
</span><span class="cx"> { return m_string.startsWith(s, caseSensitive); }
</span><span class="cx"> bool startsWith(UChar character) const
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (173696 => 173697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-09-17 18:27:42 UTC (rev 173696)
+++ trunk/Source/WebCore/ChangeLog        2014-09-17 20:01:09 UTC (rev 173697)
</span><span class="lines">@@ -1,3 +1,42 @@
</span><ins>+2014-09-17 Benjamin Poulain <bpoulain@apple.com>
+
+ CSS value in whitespace-separated list attribute selector (~=) mishandles tab/newline/etc.
+ https://bugs.webkit.org/show_bug.cgi?id=136807
+
+ Reviewed by Antti Koivisto.
+
+ The spec defines selector lists as token separated by white space.
+
+ The definition of white space for CSS Selectors is:
+ "White space in Selectors consists of the code points SPACE (U+0020),
+ TAB (U+0009), LINE FEED (U+000A), CARRIAGE RETURN (U+000D), and FORM FEED (U+000C)
+ can occur in whitespace. Other space-like code points, such as EM SPACE (U+2003)
+ and IDEOGRAPHIC SPACE (U+3000), are never part of white space."
+
+ The old code was only matching SPACE (U+0020) which is buggy. This patch
+ adds support for the other caracters.
+
+ Tests: fast/selectors/attr-list-01.html
+ fast/selectors/attribute-list-with-whitespace-in-selector.html
+ fast/selectors/attribute-list-with-whitespace-in-value.html
+
+ * css/SelectorChecker.cpp:
+ (WebCore::attributeValueMatches):
+ * cssjit/SelectorCompiler.cpp:
+ (WebCore::SelectorCompiler::constructFragments):
+ (WebCore::SelectorCompiler::attributeValueSpaceSeparetedListContains):
+ Add the missing checks.
+
+ * html/track/VTTRegion.cpp:
+ (WebCore::VTTRegion::setRegionSettings):
+ (WebCore::VTTRegion::parseSettingValue):
+ * html/track/WebVTTParser.cpp:
+ (WebCore::WebVTTParser::hasRequiredFileIdentifier):
+ (WebCore::WebVTTParser::collectTimingsAndSettings):
+ * html/track/WebVTTParser.h:
+ While looking for affected code, I discovered WebVTT redefines isHTMLSpace().
+ I cleaned that code.
+
</ins><span class="cx"> 2014-09-17 Gavin Barraclough <baraclough@apple.com>
</span><span class="cx">
</span><span class="cx"> Aways have a PageThrottler (sometimes have a UserActivity::Impl)
</span></span></pre></div>
<a id="trunkSourceWebCorecssSelectorCheckercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (173696 => 173697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SelectorChecker.cpp        2014-09-17 18:27:42 UTC (rev 173696)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp        2014-09-17 20:01:09 UTC (rev 173697)
</span><span class="lines">@@ -41,6 +41,7 @@
</span><span class="cx"> #include "HTMLNames.h"
</span><span class="cx"> #include "HTMLOptGroupElement.h"
</span><span class="cx"> #include "HTMLOptionElement.h"
</span><ins>+#include "HTMLParserIdioms.h"
</ins><span class="cx"> #include "HTMLProgressElement.h"
</span><span class="cx"> #include "HTMLStyleElement.h"
</span><span class="cx"> #include "InsertionPoint.h"
</span><span class="lines">@@ -371,8 +372,8 @@
</span><span class="cx"> break;
</span><span class="cx"> case CSSSelector::List:
</span><span class="cx"> {
</span><del>- // Ignore empty selectors or selectors containing spaces
- if (selectorValue.contains(' ') || selectorValue.isEmpty())
</del><ins>+ // Ignore empty selectors or selectors containing spaces.
+ if (selectorValue.isEmpty() || selectorValue.find(isHTMLSpace<UChar>) != notFound)
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> unsigned startSearchAt = 0;
</span><span class="lines">@@ -380,9 +381,9 @@
</span><span class="cx"> size_t foundPos = value.find(selectorValue, startSearchAt, caseSensitive);
</span><span class="cx"> if (foundPos == notFound)
</span><span class="cx"> return false;
</span><del>- if (!foundPos || value[foundPos - 1] == ' ') {
</del><ins>+ if (!foundPos || isHTMLSpace(value[foundPos - 1])) {
</ins><span class="cx"> unsigned endStr = foundPos + selectorValue.length();
</span><del>- if (endStr == value.length() || value[endStr] == ' ')
</del><ins>+ if (endStr == value.length() || isHTMLSpace(value[endStr]))
</ins><span class="cx"> break; // We found a match.
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecssjitSelectorCompilercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.cpp (173696 => 173697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/cssjit/SelectorCompiler.cpp        2014-09-17 18:27:42 UTC (rev 173696)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.cpp        2014-09-17 20:01:09 UTC (rev 173697)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #include "FunctionCall.h"
</span><span class="cx"> #include "HTMLDocument.h"
</span><span class="cx"> #include "HTMLNames.h"
</span><ins>+#include "HTMLParserIdioms.h"
</ins><span class="cx"> #include "InspectorInstrumentation.h"
</span><span class="cx"> #include "NodeRenderStyle.h"
</span><span class="cx"> #include "QualifiedName.h"
</span><span class="lines">@@ -777,7 +778,7 @@
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> case CSSSelector::List:
</span><del>- if (selector->value().contains(' '))
</del><ins>+ if (selector->value().find(isHTMLSpace<UChar>) != notFound)
</ins><span class="cx"> return FunctionType::CannotMatchAnything;
</span><span class="cx"> FALLTHROUGH;
</span><span class="cx"> case CSSSelector::Begin:
</span><span class="lines">@@ -2252,9 +2253,9 @@
</span><span class="cx"> foundPos = value.findIgnoringCase(expectedString, startSearchAt);
</span><span class="cx"> if (foundPos == notFound)
</span><span class="cx"> return false;
</span><del>- if (!foundPos || value[foundPos - 1] == ' ') {
</del><ins>+ if (!foundPos || isHTMLSpace(value[foundPos - 1])) {
</ins><span class="cx"> unsigned endStr = foundPos + expectedString->length();
</span><del>- if (endStr == value.length() || value[endStr] == ' ')
</del><ins>+ if (endStr == value.length() || isHTMLSpace(value[endStr]))
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx"> startSearchAt = foundPos + 1;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackVTTRegioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/VTTRegion.cpp (173696 => 173697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/VTTRegion.cpp        2014-09-17 18:27:42 UTC (rev 173696)
+++ trunk/Source/WebCore/html/track/VTTRegion.cpp        2014-09-17 20:01:09 UTC (rev 173697)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx"> #include "ElementChildIterator.h"
</span><span class="cx"> #include "ExceptionCodePlaceholder.h"
</span><span class="cx"> #include "HTMLDivElement.h"
</span><ins>+#include "HTMLParserIdioms.h"
</ins><span class="cx"> #include "Logging.h"
</span><span class="cx"> #include "RenderElement.h"
</span><span class="cx"> #include "VTTCue.h"
</span><span class="lines">@@ -233,7 +234,7 @@
</span><span class="cx">
</span><span class="cx"> // Verify that we're looking at a '='.
</span><span class="cx"> if (name == None || !input.scan('=')) {
</span><del>- input.skipUntil<WebVTTParser::isASpace>();
</del><ins>+ input.skipUntil<isHTMLSpace<UChar>>();
</ins><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -269,7 +270,7 @@
</span><span class="cx"> {
</span><span class="cx"> DEPRECATED_DEFINE_STATIC_LOCAL(const AtomicString, scrollUpValueKeyword, ("up", AtomicString::ConstructFromLiteral));
</span><span class="cx">
</span><del>- VTTScanner::Run valueRun = input.collectUntil<WebVTTParser::isASpace>();
</del><ins>+ VTTScanner::Run valueRun = input.collectUntil<isHTMLSpace<UChar>>();
</ins><span class="cx">
</span><span class="cx"> switch (setting) {
</span><span class="cx"> case Id: {
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackWebVTTParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/WebVTTParser.cpp (173696 => 173697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/WebVTTParser.cpp        2014-09-17 18:27:42 UTC (rev 173696)
+++ trunk/Source/WebCore/html/track/WebVTTParser.cpp        2014-09-17 20:01:09 UTC (rev 173697)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx">
</span><span class="cx"> #include "WebVTTParser.h"
</span><span class="cx">
</span><ins>+#include "HTMLParserIdioms.h"
</ins><span class="cx"> #include "ISOVTTCue.h"
</span><span class="cx"> #include "ProcessingInstruction.h"
</span><span class="cx"> #include "Text.h"
</span><span class="lines">@@ -258,7 +259,7 @@
</span><span class="cx"> if (!line.startsWith(fileIdentifier, fileIdentifierLength))
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (line.length() > fileIdentifierLength && !isASpace(line[fileIdentifierLength]))
</del><ins>+ if (line.length() > fileIdentifierLength && !isHTMLSpace(line[fileIdentifierLength]))
</ins><span class="cx"> return false;
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="lines">@@ -306,25 +307,25 @@
</span><span class="cx">
</span><span class="cx"> // Collect WebVTT cue timings and settings. (5.3 WebVTT cue timings and settings parsing.)
</span><span class="cx"> // Steps 1 - 3 - Let input be the string being parsed and position be a pointer into input
</span><del>- input.skipWhile<isASpace>();
</del><ins>+ input.skipWhile<isHTMLSpace<UChar>>();
</ins><span class="cx">
</span><span class="cx"> // Steps 4 - 5 - Collect a WebVTT timestamp. If that fails, then abort and return failure. Otherwise, let cue's text track cue start time be the collected time.
</span><span class="cx"> if (!collectTimeStamp(input, m_currentStartTime))
</span><span class="cx"> return BadCue;
</span><span class="cx">
</span><del>- input.skipWhile<isASpace>();
</del><ins>+ input.skipWhile<isHTMLSpace<UChar>>();
</ins><span class="cx">
</span><span class="cx"> // Steps 6 - 9 - If the next three characters are not "-->", abort and return failure.
</span><span class="cx"> if (!input.scan("-->"))
</span><span class="cx"> return BadCue;
</span><span class="cx">
</span><del>- input.skipWhile<isASpace>();
</del><ins>+ input.skipWhile<isHTMLSpace<UChar>>();
</ins><span class="cx">
</span><span class="cx"> // Steps 10 - 11 - Collect a WebVTT timestamp. If that fails, then abort and return failure. Otherwise, let cue's text track cue end time be the collected time.
</span><span class="cx"> if (!collectTimeStamp(input, m_currentEndTime))
</span><span class="cx"> return BadCue;
</span><span class="cx">
</span><del>- input.skipWhile<isASpace>();
</del><ins>+ input.skipWhile<isHTMLSpace<UChar>>();
</ins><span class="cx">
</span><span class="cx"> // Step 12 - Parse the WebVTT settings for the cue (conducted in TextTrackCue).
</span><span class="cx"> m_currentSettings = input.restOfInputAsString();
</span></span></pre></div>
<a id="trunkSourceWebCorehtmltrackWebVTTParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/track/WebVTTParser.h (173696 => 173697)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/track/WebVTTParser.h        2014-09-17 18:27:42 UTC (rev 173696)
+++ trunk/Source/WebCore/html/track/WebVTTParser.h        2014-09-17 20:01:09 UTC (rev 173697)
</span><span class="lines">@@ -122,11 +122,6 @@
</span><span class="cx"> || tagName == rtTag;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- static inline bool isASpace(UChar c)
- {
- // WebVTT space characters are U+0020 SPACE, U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED (LF), U+000C FORM FEED (FF), and U+000D CARRIAGE RETURN (CR).
- return c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r';
- }
</del><span class="cx"> static inline bool isValidSettingDelimiter(UChar c)
</span><span class="cx"> {
</span><span class="cx"> // ... a WebVTT cue consists of zero or more of the following components, in any order, separated from each other by one or more
</span></span></pre>
</div>
</div>
</body>
</html>