<!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>[204952] 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/204952">204952</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-08-24 19:40:55 -0700 (Wed, 24 Aug 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Implement `CSS.escape` as per CSSOM
https://bugs.webkit.org/show_bug.cgi?id=126337
Patch by Joseph Pecoraro <pecoraro@apple.com> on 2016-08-24
Reviewed by Dean Jackson.
Source/WebCore:
Test: css3/escape-dom-api.html
* css/CSSOMUtils.cpp:
(WebCore::serializeIdentifier):
Update serialization to match the latest version of the spec:
<https://drafts.csswg.org/cssom/#serialize-an-identifier>
New handling for 0x0, 0x7f, just "-", and "--" is now allowed.
* css/DOMCSSNamespace.cpp:
(WebCore::DOMCSSNamespace::escape):
* css/DOMCSSNamespace.h:
* css/DOMCSSNamespace.idl:
New CSS.escape method.
LayoutTests:
CSS.escape is part of the CSSOM Spec:
https://drafts.csswg.org/cssom/#the-css.escape%28%29-method
Tests:
https://github.com/mathiasbynens/CSS.escape/blob/master/tests/tests.js
Change is based on the Blink change (patch by <rob.buis@samsung.com>) and follow-ups:
<https://chromium.googlesource.com/chromium/blink/+/c1a5ffdc924b089e70cd33ad2726b58cc8312abe>
* css3/escape-dom-api-expected.txt: Added.
* css3/escape-dom-api.html: Added.
New tests, taken from the polyfill.
* fast/css/parsing-css-nonascii-expected.txt:
* fast/css/parsing-css-nonascii.html:
* fast/css/selector-text-escape.html:
Update existing tests now that 0x7f is escaped.
* js/dom/function-removed-after-parsing-expected.txt:
* js/dom/function-removed-after-parsing.html:
Rename use of `CSS.escape` here now that `CSS.escape` exists.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastcssparsingcssnonasciiexpectedtxt">trunk/LayoutTests/fast/css/parsing-css-nonascii-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcssparsingcssnonasciihtml">trunk/LayoutTests/fast/css/parsing-css-nonascii.html</a></li>
<li><a href="#trunkLayoutTestsfastcssselectortextescapehtml">trunk/LayoutTests/fast/css/selector-text-escape.html</a></li>
<li><a href="#trunkLayoutTestsjsdomfunctionremovedafterparsingexpectedtxt">trunk/LayoutTests/js/dom/function-removed-after-parsing-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsdomfunctionremovedafterparsinghtml">trunk/LayoutTests/js/dom/function-removed-after-parsing.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSOMUtilscpp">trunk/Source/WebCore/css/CSSOMUtils.cpp</a></li>
<li><a href="#trunkSourceWebCorecssDOMCSSNamespacecpp">trunk/Source/WebCore/css/DOMCSSNamespace.cpp</a></li>
<li><a href="#trunkSourceWebCorecssDOMCSSNamespaceh">trunk/Source/WebCore/css/DOMCSSNamespace.h</a></li>
<li><a href="#trunkSourceWebCorecssDOMCSSNamespaceidl">trunk/Source/WebCore/css/DOMCSSNamespace.idl</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscss3escapedomapiexpectedtxt">trunk/LayoutTests/css3/escape-dom-api-expected.txt</a></li>
<li><a href="#trunkLayoutTestscss3escapedomapihtml">trunk/LayoutTests/css3/escape-dom-api.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (204951 => 204952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-08-25 01:55:04 UTC (rev 204951)
+++ trunk/LayoutTests/ChangeLog        2016-08-25 02:40:55 UTC (rev 204952)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2016-08-24 Joseph Pecoraro <pecoraro@apple.com>
+
+ Implement `CSS.escape` as per CSSOM
+ https://bugs.webkit.org/show_bug.cgi?id=126337
+
+ Reviewed by Dean Jackson.
+
+ CSS.escape is part of the CSSOM Spec:
+ https://drafts.csswg.org/cssom/#the-css.escape%28%29-method
+
+ Tests:
+ https://github.com/mathiasbynens/CSS.escape/blob/master/tests/tests.js
+
+ Change is based on the Blink change (patch by <rob.buis@samsung.com>) and follow-ups:
+ <https://chromium.googlesource.com/chromium/blink/+/c1a5ffdc924b089e70cd33ad2726b58cc8312abe>
+
+ * css3/escape-dom-api-expected.txt: Added.
+ * css3/escape-dom-api.html: Added.
+ New tests, taken from the polyfill.
+
+ * fast/css/parsing-css-nonascii-expected.txt:
+ * fast/css/parsing-css-nonascii.html:
+ * fast/css/selector-text-escape.html:
+ Update existing tests now that 0x7f is escaped.
+
+ * js/dom/function-removed-after-parsing-expected.txt:
+ * js/dom/function-removed-after-parsing.html:
+ Rename use of `CSS.escape` here now that `CSS.escape` exists.
+
</ins><span class="cx"> 2016-08-24 Zalan Bujtas <zalan@apple.com>
</span><span class="cx">
</span><span class="cx"> ASSERTION FAILED: contentSize >= 0 in WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax
</span></span></pre></div>
<a id="trunkLayoutTestscss3escapedomapiexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/escape-dom-api-expected.txt (0 => 204952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/escape-dom-api-expected.txt         (rev 0)
+++ trunk/LayoutTests/css3/escape-dom-api-expected.txt        2016-08-25 02:40:55 UTC (rev 204952)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+Test window.CSS.escape()
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS CSS.escape.length is 1
+PASS CSS.escape('\0') is "�"
+PASS CSS.escape('a\0') is "a�"
+PASS CSS.escape('\0b') is "�b"
+PASS CSS.escape('a\0b') is "a�b"
+PASS CSS.escape('�') is "�"
+PASS CSS.escape('a�') is "a�"
+PASS CSS.escape('�b') is "�b"
+PASS CSS.escape('a�b') is "a�b"
+PASS CSS.escape() threw exception TypeError: Not enough arguments.
+PASS CSS.escape(undefined) is "undefined"
+PASS CSS.escape(true) is "true"
+PASS CSS.escape(false) is "false"
+PASS CSS.escape(null) is "null"
+PASS CSS.escape('') is ""
+PASS CSS.escape('') is "\\1 \\2 \\1e \\1f "
+PASS CSS.escape('0a') is "\\30 a"
+PASS CSS.escape('1a') is "\\31 a"
+PASS CSS.escape('2a') is "\\32 a"
+PASS CSS.escape('3a') is "\\33 a"
+PASS CSS.escape('4a') is "\\34 a"
+PASS CSS.escape('5a') is "\\35 a"
+PASS CSS.escape('6a') is "\\36 a"
+PASS CSS.escape('7a') is "\\37 a"
+PASS CSS.escape('8a') is "\\38 a"
+PASS CSS.escape('9a') is "\\39 a"
+PASS CSS.escape('a0b') is "a0b"
+PASS CSS.escape('a1b') is "a1b"
+PASS CSS.escape('a2b') is "a2b"
+PASS CSS.escape('a3b') is "a3b"
+PASS CSS.escape('a4b') is "a4b"
+PASS CSS.escape('a5b') is "a5b"
+PASS CSS.escape('a6b') is "a6b"
+PASS CSS.escape('a7b') is "a7b"
+PASS CSS.escape('a8b') is "a8b"
+PASS CSS.escape('a9b') is "a9b"
+PASS CSS.escape('-0a') is "-\\30 a"
+PASS CSS.escape('-1a') is "-\\31 a"
+PASS CSS.escape('-2a') is "-\\32 a"
+PASS CSS.escape('-3a') is "-\\33 a"
+PASS CSS.escape('-4a') is "-\\34 a"
+PASS CSS.escape('-5a') is "-\\35 a"
+PASS CSS.escape('-6a') is "-\\36 a"
+PASS CSS.escape('-7a') is "-\\37 a"
+PASS CSS.escape('-8a') is "-\\38 a"
+PASS CSS.escape('-9a') is "-\\39 a"
+PASS CSS.escape('-') is "\\-"
+PASS CSS.escape('-a') is "-a"
+PASS CSS.escape('--') is "--"
+PASS CSS.escape('--a') is "--a"
+PASS CSS.escape('Â-_©') is "Â-_©"
+PASS CSS.escape('ÂÂÂÂÂÂ
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ') is "\\7f ÂÂÂÂÂÂ
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ"
+PASS CSS.escape(' ¡¢') is " ¡¢"
+PASS CSS.escape('a0123456789b') is "a0123456789b"
+PASS CSS.escape('abcdefghijklmnopqrstuvwxyz') is "abcdefghijklmnopqrstuvwxyz"
+PASS CSS.escape('ABCDEFGHIJKLMNOPQRSTUVWXYZ') is "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+PASS CSS.escape(' !xy') is "\\ \\!xy"
+PASS CSS.escape('ð') is "ð"
+PASS CSS.escape('í¼') is "í¼"
+PASS CSS.escape('í ´') is "í ´"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscss3escapedomapihtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/css3/escape-dom-api.html (0 => 204952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/escape-dom-api.html         (rev 0)
+++ trunk/LayoutTests/css3/escape-dom-api.html        2016-08-25 02:40:55 UTC (rev 204952)
</span><span class="lines">@@ -0,0 +1,86 @@
</span><ins>+<!DOCTYPE HTML>
+<html>
+<head>
+<script src="../resources/js-test.js"></script>
+</head>
+<body>
+<script>
+ // Test from https://github.com/mathiasbynens/CSS.escape
+ description("Test window.CSS.escape()");
+
+ shouldBe("CSS.escape.length", "1");
+
+ shouldBeEqualToString("CSS.escape('\0')", "\ufffd");
+ shouldBeEqualToString("CSS.escape('a\0')", "a\ufffd");
+ shouldBeEqualToString("CSS.escape('\0b')", "\ufffdb");
+ shouldBeEqualToString("CSS.escape('a\0b')", "a\ufffdb");
+
+ shouldBeEqualToString("CSS.escape('\ufffd')", "\ufffd");
+ shouldBeEqualToString("CSS.escape('a\ufffd')", "a\ufffd");
+ shouldBeEqualToString("CSS.escape('\ufffdb')", "\ufffdb");
+ shouldBeEqualToString("CSS.escape('a\ufffdb')", "a\ufffdb");
+
+ shouldThrow("CSS.escape()");
+ shouldBeEqualToString("CSS.escape(undefined)", "undefined");
+ shouldBeEqualToString("CSS.escape(true)", "true");
+ shouldBeEqualToString("CSS.escape(false)", "false");
+ shouldBeEqualToString("CSS.escape(null)", "null");
+ shouldBeEqualToString("CSS.escape('')", "");
+
+ shouldBeEqualToString("CSS.escape('\x01\x02\x1E\x1F')", "\\1 \\2 \\1e \\1f ");
+
+ shouldBeEqualToString("CSS.escape('0a')", "\\30 a");
+ shouldBeEqualToString("CSS.escape('1a')", "\\31 a");
+ shouldBeEqualToString("CSS.escape('2a')", "\\32 a");
+ shouldBeEqualToString("CSS.escape('3a')", "\\33 a");
+ shouldBeEqualToString("CSS.escape('4a')", "\\34 a");
+ shouldBeEqualToString("CSS.escape('5a')", "\\35 a");
+ shouldBeEqualToString("CSS.escape('6a')", "\\36 a");
+ shouldBeEqualToString("CSS.escape('7a')", "\\37 a");
+ shouldBeEqualToString("CSS.escape('8a')", "\\38 a");
+ shouldBeEqualToString("CSS.escape('9a')", "\\39 a");
+
+ shouldBeEqualToString("CSS.escape('a0b')", "a0b");
+ shouldBeEqualToString("CSS.escape('a1b')", "a1b");
+ shouldBeEqualToString("CSS.escape('a2b')", "a2b");
+ shouldBeEqualToString("CSS.escape('a3b')", "a3b");
+ shouldBeEqualToString("CSS.escape('a4b')", "a4b");
+ shouldBeEqualToString("CSS.escape('a5b')", "a5b");
+ shouldBeEqualToString("CSS.escape('a6b')", "a6b");
+ shouldBeEqualToString("CSS.escape('a7b')", "a7b");
+ shouldBeEqualToString("CSS.escape('a8b')", "a8b");
+ shouldBeEqualToString("CSS.escape('a9b')", "a9b");
+
+ shouldBeEqualToString("CSS.escape('-0a')", "-\\30 a");
+ shouldBeEqualToString("CSS.escape('-1a')", "-\\31 a");
+ shouldBeEqualToString("CSS.escape('-2a')", "-\\32 a");
+ shouldBeEqualToString("CSS.escape('-3a')", "-\\33 a");
+ shouldBeEqualToString("CSS.escape('-4a')", "-\\34 a");
+ shouldBeEqualToString("CSS.escape('-5a')", "-\\35 a");
+ shouldBeEqualToString("CSS.escape('-6a')", "-\\36 a");
+ shouldBeEqualToString("CSS.escape('-7a')", "-\\37 a");
+ shouldBeEqualToString("CSS.escape('-8a')", "-\\38 a");
+ shouldBeEqualToString("CSS.escape('-9a')", "-\\39 a");
+
+ shouldBeEqualToString("CSS.escape('-')", "\\-");
+ shouldBeEqualToString("CSS.escape('-a')", "-a");
+ shouldBeEqualToString("CSS.escape('--')", "--");
+ shouldBeEqualToString("CSS.escape('--a')", "--a");
+
+ shouldBeEqualToString("CSS.escape('\x80\x2D\x5F\xA9')", "\x80\x2D\x5F\xA9");
+ shouldBeEqualToString("CSS.escape('\x7F\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F')", "\\7f \x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F");
+ shouldBeEqualToString("CSS.escape('\xA0\xA1\xA2')", "\xA0\xA1\xA2");
+ shouldBeEqualToString("CSS.escape('a0123456789b')", "a0123456789b");
+ shouldBeEqualToString("CSS.escape('abcdefghijklmnopqrstuvwxyz')", "abcdefghijklmnopqrstuvwxyz");
+ shouldBeEqualToString("CSS.escape('ABCDEFGHIJKLMNOPQRSTUVWXYZ')", "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+
+ shouldBeEqualToString("CSS.escape('\x20\x21\x78\x79')", "\\ \\!xy");
+
+ // astral symbol (U+1D306 TETRAGRAM FOR CENTRE)
+ shouldBeEqualToString("CSS.escape('\uD834\uDF06')", "\uD834\uDF06");
+ // lone surrogates
+ shouldBeEqualToString("CSS.escape('\uDF06')", '\uDF06');
+ shouldBeEqualToString("CSS.escape('\uD834')", '\uD834');
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssparsingcssnonasciiexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css/parsing-css-nonascii-expected.txt (204951 => 204952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/parsing-css-nonascii-expected.txt        2016-08-25 01:55:04 UTC (rev 204951)
+++ trunk/LayoutTests/fast/css/parsing-css-nonascii-expected.txt        2016-08-25 02:40:55 UTC (rev 204952)
</span><span class="lines">@@ -4,7 +4,7 @@
</span><span class="cx">
</span><span class="cx"> Rules from the stylesheet:
</span><span class="cx">
</span><del>-#a127_\ { color: red; }
</del><ins>+#a127_\7f { color: red; }
</ins><span class="cx"> #a128_ { color: red; }
</span><span class="cx"> #b128_ { color: green; }
</span><span class="cx"> #a159_ { color: red; }
</span><span class="lines">@@ -15,7 +15,7 @@
</span><span class="cx"> #b384_ƀ { color: green; }
</span><span class="cx"> Expected result:
</span><span class="cx">
</span><del>-#a127_\ { color: red; }
</del><ins>+#a127_\7f { color: red; }
</ins><span class="cx"> #a128_ { color: red; }
</span><span class="cx"> #b128_ { color: green; }
</span><span class="cx"> #a159_ { color: red; }
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssparsingcssnonasciihtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css/parsing-css-nonascii.html (204951 => 204952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/parsing-css-nonascii.html        2016-08-25 01:55:04 UTC (rev 204951)
+++ trunk/LayoutTests/fast/css/parsing-css-nonascii.html        2016-08-25 02:40:55 UTC (rev 204952)
</span><span class="lines">@@ -5,7 +5,7 @@
</span><span class="cx"> /*
</span><span class="cx"> === Warning ===
</span><span class="cx">
</span><del>- This file intentionally contains scpecial characters which
</del><ins>+ This file intentionally contains special characters which
</ins><span class="cx"> cannot be displayed by some text editors. Please
</span><span class="cx"> carefully edit the file.
</span><span class="cx"> */
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx">
</span><span class="cx"> <p>Expected result:</p>
</span><span class="cx">
</span><del>-<pre id="expected">#a127_\ { color: red; }
</del><ins>+<pre id="expected">#a127_\7f { color: red; }
</ins><span class="cx"> #a128_ { color: red; }
</span><span class="cx"> #b128_ { color: green; }
</span><span class="cx"> #a159_ { color: red; }
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssselectortextescapehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css/selector-text-escape.html (204951 => 204952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/selector-text-escape.html        2016-08-25 01:55:04 UTC (rev 204951)
+++ trunk/LayoutTests/fast/css/selector-text-escape.html        2016-08-25 02:40:55 UTC (rev 204952)
</span><span class="lines">@@ -93,7 +93,7 @@
</span><span class="cx"> ".\\39 _class",
</span><span class="cx"> ".-\\30 _class",
</span><span class="cx"> ".-\\39 _class",
</span><del>- ".-\\-_class",
</del><ins>+ ".--_class",
</ins><span class="cx"> ".\x81_class",
</span><span class="cx"> ".日本語_class",
</span><span class="cx"> ".𐐀_class",
</span></span></pre></div>
<a id="trunkLayoutTestsjsdomfunctionremovedafterparsingexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/dom/function-removed-after-parsing-expected.txt (204951 => 204952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/function-removed-after-parsing-expected.txt        2016-08-25 01:55:04 UTC (rev 204951)
+++ trunk/LayoutTests/js/dom/function-removed-after-parsing-expected.txt        2016-08-25 02:40:55 UTC (rev 204952)
</span><span class="lines">@@ -1,2 +1,2 @@
</span><del>-window.CSS.escape still here
</del><ins>+window.CSS.layoutTestEscape still here
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsjsdomfunctionremovedafterparsinghtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/dom/function-removed-after-parsing.html (204951 => 204952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/function-removed-after-parsing.html        2016-08-25 01:55:04 UTC (rev 204951)
+++ trunk/LayoutTests/js/dom/function-removed-after-parsing.html        2016-08-25 02:40:55 UTC (rev 204952)
</span><span class="lines">@@ -2,6 +2,9 @@
</span><span class="cx"> <!--
</span><span class="cx"> NOTE: This intentionally does not use description() and does not include js-test-post because
</span><span class="cx"> doing either of those things made the bug go away.
</span><ins>+
+NOTE: This intentionally does not use the name `CSS.escape` because that function exists now but
+did not when this test was added. The name was changed to `CSS.layoutTestEscape` for this test.
</ins><span class="cx"> -->
</span><span class="cx"> <script src="../../resources/js-test-pre.js"></script>
</span><span class="cx"> <script type='text/javascript'>
</span><span class="lines">@@ -20,9 +23,9 @@
</span><span class="cx">         InvalidCharacterError.prototype = new Error;
</span><span class="cx">         InvalidCharacterError.prototype.name = 'InvalidCharacterError';
</span><span class="cx">
</span><del>-        if (!CSS.escape) {
</del><ins>+        if (!CSS.layoutTestEscape) {
</ins><span class="cx">                 // https://drafts.csswg.org/cssom/#serialize-an-identifier
</span><del>-                CSS.escape = function(value) {
</del><ins>+                CSS.layoutTestEscape = function(value) {
</ins><span class="cx">                         var string = String(value);
</span><span class="cx">                         var length = string.length;
</span><span class="cx">                         var index = -1;
</span><span class="lines">@@ -107,14 +110,14 @@
</span><span class="cx"> testRunner.dumpAsText(window.enablePixelTesting);
</span><span class="cx"> testRunner.waitUntilDone();
</span><span class="cx"> } catch (e) { }
</span><del>- if (!window.CSS.escape) {
- debug('window.CSS.escape not loaded');
</del><ins>+ if (!window.CSS.layoutTestEscape) {
+ debug('window.CSS.layoutTestEscape not loaded');
</ins><span class="cx"> }
</span><span class="cx"> setTimeout(function() {
</span><del>- if (window.CSS.escape)
- debug("window.CSS.escape still here");
</del><ins>+ if (window.CSS.layoutTestEscape)
+ debug("window.CSS.layoutTestEscape still here");
</ins><span class="cx"> else
</span><del>- debug('window.CSS.escape missing in event');
</del><ins>+ debug('window.CSS.layoutTestEscape missing in event');
</ins><span class="cx"> try {
</span><span class="cx"> testRunner.notifyDone();
</span><span class="cx"> } catch (e) { }
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (204951 => 204952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-25 01:55:04 UTC (rev 204951)
+++ trunk/Source/WebCore/ChangeLog        2016-08-25 02:40:55 UTC (rev 204952)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2016-08-24 Joseph Pecoraro <pecoraro@apple.com>
+
+ Implement `CSS.escape` as per CSSOM
+ https://bugs.webkit.org/show_bug.cgi?id=126337
+
+ Reviewed by Dean Jackson.
+
+ Test: css3/escape-dom-api.html
+
+ * css/CSSOMUtils.cpp:
+ (WebCore::serializeIdentifier):
+ Update serialization to match the latest version of the spec:
+ <https://drafts.csswg.org/cssom/#serialize-an-identifier>
+ New handling for 0x0, 0x7f, just "-", and "--" is now allowed.
+
+ * css/DOMCSSNamespace.cpp:
+ (WebCore::DOMCSSNamespace::escape):
+ * css/DOMCSSNamespace.h:
+ * css/DOMCSSNamespace.idl:
+ New CSS.escape method.
+
</ins><span class="cx"> 2016-08-24 Zalan Bujtas <zalan@apple.com>
</span><span class="cx">
</span><span class="cx"> ASSERTION FAILED: contentSize >= 0 in WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSOMUtilscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSOMUtils.cpp (204951 => 204952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSOMUtils.cpp        2016-08-25 01:55:04 UTC (rev 204951)
+++ trunk/Source/WebCore/css/CSSOMUtils.cpp        2016-08-25 02:40:55 UTC (rev 204952)
</span><span class="lines">@@ -57,11 +57,18 @@
</span><span class="cx"> unsigned index = 0;
</span><span class="cx"> while (index < identifier.length()) {
</span><span class="cx"> UChar32 c = identifier.characterStartingAt(index);
</span><ins>+ if (!c) {
+ // Check for lone surrogate which characterStartingAt does not return.
+ c = identifier[index];
+ }
+
</ins><span class="cx"> index += U16_LENGTH(c);
</span><span class="cx">
</span><del>- if (c <= 0x1f || (0x30 <= c && c <= 0x39 && (isFirst || (isSecond && isFirstCharHyphen))))
</del><ins>+ if (!c)
+ appendTo.append(0xfffd);
+ else if (c <= 0x1f || c == 0x7f || (0x30 <= c && c <= 0x39 && (isFirst || (isSecond && isFirstCharHyphen))))
</ins><span class="cx"> serializeCharacterAsCodePoint(c, appendTo);
</span><del>- else if (c == 0x2d && isSecond && isFirstCharHyphen)
</del><ins>+ else if (c == 0x2d && isFirst && index == identifier.length())
</ins><span class="cx"> serializeCharacter(c, appendTo);
</span><span class="cx"> else if (0x80 <= c || c == 0x2d || c == 0x5f || (0x30 <= c && c <= 0x39) || (0x41 <= c && c <= 0x5a) || (0x61 <= c && c <= 0x7a))
</span><span class="cx"> appendTo.append(c);
</span><span class="lines">@@ -72,9 +79,8 @@
</span><span class="cx"> isFirst = false;
</span><span class="cx"> isSecond = true;
</span><span class="cx"> isFirstCharHyphen = (c == 0x2d);
</span><del>- } else if (isSecond) {
</del><ins>+ } else if (isSecond)
</ins><span class="cx"> isSecond = false;
</span><del>- }
</del><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecssDOMCSSNamespacecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/DOMCSSNamespace.cpp (204951 => 204952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/DOMCSSNamespace.cpp        2016-08-25 01:55:04 UTC (rev 204951)
+++ trunk/Source/WebCore/css/DOMCSSNamespace.cpp        2016-08-25 02:40:55 UTC (rev 204952)
</span><span class="lines">@@ -30,8 +30,10 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "DOMCSSNamespace.h"
</span><span class="cx">
</span><ins>+#include "CSSOMUtils.h"
</ins><span class="cx"> #include "CSSParser.h"
</span><span class="cx"> #include "StyleProperties.h"
</span><ins>+#include <wtf/text/StringBuilder.h>
</ins><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -77,4 +79,11 @@
</span><span class="cx"> return parser.parseSupportsCondition(conditionText);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+String DOMCSSNamespace::escape(const String& ident)
+{
+ StringBuilder builder;
+ serializeIdentifier(ident, builder);
+ return builder.toString();
</ins><span class="cx"> }
</span><ins>+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCorecssDOMCSSNamespaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/DOMCSSNamespace.h (204951 => 204952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/DOMCSSNamespace.h        2016-08-25 01:55:04 UTC (rev 204951)
+++ trunk/Source/WebCore/css/DOMCSSNamespace.h        2016-08-25 02:40:55 UTC (rev 204952)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> public:
</span><span class="cx"> static bool supports(const String& property, const String& value);
</span><span class="cx"> static bool supports(const String& conditionText);
</span><ins>+ static String escape(const String& ident);
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssDOMCSSNamespaceidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/DOMCSSNamespace.idl (204951 => 204952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/DOMCSSNamespace.idl        2016-08-25 01:55:04 UTC (rev 204951)
+++ trunk/Source/WebCore/css/DOMCSSNamespace.idl        2016-08-25 02:40:55 UTC (rev 204952)
</span><span class="lines">@@ -33,4 +33,5 @@
</span><span class="cx"> ] interface DOMCSSNamespace {
</span><span class="cx"> static boolean supports(DOMString property, DOMString value);
</span><span class="cx"> static boolean supports(DOMString conditionText);
</span><ins>+ static DOMString escape(DOMString ident);
</ins><span class="cx"> };
</span></span></pre>
</div>
</div>
</body>
</html>