<!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>[174323] trunk/Source/WebInspectorUI</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/174323">174323</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-10-04 15:11:57 -0700 (Sat, 04 Oct 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Inspector: Add PrettyPrinter CSS tests
https://bugs.webkit.org/show_bug.cgi?id=134005
Patch by Joseph Pecoraro <pecoraro@apple.com> on 2014-10-04
Reviewed by Timothy Hatcher.
Add CSS pretty printing tests. Improve pretty printing of calc()
expressions and media-queries with whitespace around operators
and keywords. Also fix the debug output in the tool for CSS.
* Tools/PrettyPrinting/CodeMirrorFormatters.js:
* Tools/PrettyPrinting/FormatterContentBuilder.js:
(FormatterContentBuilder.prototype._appendIndent):
* Tools/PrettyPrinting/FormatterDebug.js:
(.debugToken):
(Formatter.prototype.debug):
* Tools/PrettyPrinting/css-tests/basic-expected.css: Added.
* Tools/PrettyPrinting/css-tests/basic.css: Added.
* Tools/PrettyPrinting/css-tests/calc-expected.css: Added.
* Tools/PrettyPrinting/css-tests/calc.css: Added.
* Tools/PrettyPrinting/css-tests/media-query-expected.css: Added.
* Tools/PrettyPrinting/css-tests/media-query.css: Added.
* Tools/PrettyPrinting/css-tests/selectors-expected.css: Added.
* Tools/PrettyPrinting/css-tests/selectors.css: Added.
* Tools/PrettyPrinting/index.html:
* UserInterface/Views/CodeMirrorFormatters.js:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIToolsPrettyPrintingCodeMirrorFormattersjs">trunk/Source/WebInspectorUI/Tools/PrettyPrinting/CodeMirrorFormatters.js</a></li>
<li><a href="#trunkSourceWebInspectorUIToolsPrettyPrintingFormatterContentBuilderjs">trunk/Source/WebInspectorUI/Tools/PrettyPrinting/FormatterContentBuilder.js</a></li>
<li><a href="#trunkSourceWebInspectorUIToolsPrettyPrintingFormatterDebugjs">trunk/Source/WebInspectorUI/Tools/PrettyPrinting/FormatterDebug.js</a></li>
<li><a href="#trunkSourceWebInspectorUIToolsPrettyPrintingindexhtml">trunk/Source/WebInspectorUI/Tools/PrettyPrinting/index.html</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsCodeMirrorFormattersjs">trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorFormatters.js</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/</li>
<li><a href="#trunkSourceWebInspectorUIToolsPrettyPrintingcsstestsbasicexpectedcss">trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/basic-expected.css</a></li>
<li><a href="#trunkSourceWebInspectorUIToolsPrettyPrintingcsstestsbasiccss">trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/basic.css</a></li>
<li><a href="#trunkSourceWebInspectorUIToolsPrettyPrintingcsstestscalcexpectedcss">trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/calc-expected.css</a></li>
<li><a href="#trunkSourceWebInspectorUIToolsPrettyPrintingcsstestscalccss">trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/calc.css</a></li>
<li><a href="#trunkSourceWebInspectorUIToolsPrettyPrintingcsstestsmediaqueryexpectedcss">trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/media-query-expected.css</a></li>
<li><a href="#trunkSourceWebInspectorUIToolsPrettyPrintingcsstestsmediaquerycss">trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/media-query.css</a></li>
<li><a href="#trunkSourceWebInspectorUIToolsPrettyPrintingcsstestsselectorsexpectedcss">trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/selectors-expected.css</a></li>
<li><a href="#trunkSourceWebInspectorUIToolsPrettyPrintingcsstestsselectorscss">trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/selectors.css</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (174322 => 174323)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2014-10-04 21:55:58 UTC (rev 174322)
+++ trunk/Source/WebInspectorUI/ChangeLog        2014-10-04 22:11:57 UTC (rev 174323)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2014-10-04 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Add PrettyPrinter CSS tests
+ https://bugs.webkit.org/show_bug.cgi?id=134005
+
+ Reviewed by Timothy Hatcher.
+
+ Add CSS pretty printing tests. Improve pretty printing of calc()
+ expressions and media-queries with whitespace around operators
+ and keywords. Also fix the debug output in the tool for CSS.
+
+ * Tools/PrettyPrinting/CodeMirrorFormatters.js:
+ * Tools/PrettyPrinting/FormatterContentBuilder.js:
+ (FormatterContentBuilder.prototype._appendIndent):
+ * Tools/PrettyPrinting/FormatterDebug.js:
+ (.debugToken):
+ (Formatter.prototype.debug):
+ * Tools/PrettyPrinting/css-tests/basic-expected.css: Added.
+ * Tools/PrettyPrinting/css-tests/basic.css: Added.
+ * Tools/PrettyPrinting/css-tests/calc-expected.css: Added.
+ * Tools/PrettyPrinting/css-tests/calc.css: Added.
+ * Tools/PrettyPrinting/css-tests/media-query-expected.css: Added.
+ * Tools/PrettyPrinting/css-tests/media-query.css: Added.
+ * Tools/PrettyPrinting/css-tests/selectors-expected.css: Added.
+ * Tools/PrettyPrinting/css-tests/selectors.css: Added.
+ * Tools/PrettyPrinting/index.html:
+ * UserInterface/Views/CodeMirrorFormatters.js:
+
</ins><span class="cx"> 2014-10-04 Brian J. Burg <burg@cs.washington.edu>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r174319.
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIToolsPrettyPrintingCodeMirrorFormattersjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/Tools/PrettyPrinting/CodeMirrorFormatters.js (174322 => 174323)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Tools/PrettyPrinting/CodeMirrorFormatters.js        2014-10-04 21:55:58 UTC (rev 174322)
+++ trunk/Source/WebInspectorUI/Tools/PrettyPrinting/CodeMirrorFormatters.js        2014-10-04 22:11:57 UTC (rev 174323)
</span><span class="lines">@@ -300,7 +300,7 @@
</span><span class="cx"> if (!token) {
</span><span class="cx"> if (content === "{")
</span><span class="cx"> return true;
</span><del>- return false;
</del><ins>+ return ">+~-*/".indexOf(content) >= 0; // calc() expression or child/sibling selectors
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (isComment)
</span><span class="lines">@@ -322,12 +322,17 @@
</span><span class="cx"> return true;
</span><span class="cx"> if (lastContent === ":") // Space in "prop: value" but not in a selectors "a:link" or "div::after" or media queries "(max-device-width:480px)".
</span><span class="cx"> return state.state === "prop";
</span><del>- return false;
</del><ins>+ if (lastContent === ")" && (content !== ")" && content !== ",")) // Space in "not(foo)and" but not at the end of "not(not(foo))"
+ return state.state === "media" || state.state === "media_parens";
+ return ">+~-*/".indexOf(lastContent) >= 0; // calc() expression or child/sibling selectors
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (/\bcomment\b/.test(lastToken))
</span><span class="cx"> return true;
</span><span class="cx">
</span><ins>+ if (/\bkeyword\b/.test(lastToken)) // media-query keywords
+ return state.state === "media" || state.state === "media_parens";
+
</ins><span class="cx"> return false;
</span><span class="cx"> },
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIToolsPrettyPrintingFormatterContentBuilderjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/Tools/PrettyPrinting/FormatterContentBuilder.js (174322 => 174323)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Tools/PrettyPrinting/FormatterContentBuilder.js        2014-10-04 21:55:58 UTC (rev 174322)
+++ trunk/Source/WebInspectorUI/Tools/PrettyPrinting/FormatterContentBuilder.js        2014-10-04 22:11:57 UTC (rev 174323)
</span><span class="lines">@@ -196,7 +196,7 @@
</span><span class="cx"> const maxCacheIndent = 20;
</span><span class="cx"> var max = Math.min(this._indent, maxCacheIndent);
</span><span class="cx"> for (var i = this._indentCache.length; i <= max; ++i)
</span><del>- this._indentCache[i] = this._indentCache[i-1] + this._indentString;
</del><ins>+ this._indentCache[i] = this._indentCache[i - 1] + this._indentString;
</ins><span class="cx">
</span><span class="cx"> // Append indents as needed.
</span><span class="cx"> var indent = this._indent;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIToolsPrettyPrintingFormatterDebugjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/Tools/PrettyPrinting/FormatterDebug.js (174322 => 174323)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Tools/PrettyPrinting/FormatterDebug.js        2014-10-04 21:55:58 UTC (rev 174322)
+++ trunk/Source/WebInspectorUI/Tools/PrettyPrinting/FormatterDebug.js        2014-10-04 22:11:57 UTC (rev 174323)
</span><span class="lines">@@ -23,11 +23,13 @@
</span><span class="cx">
</span><span class="cx"> // Language Specific Info
</span><span class="cx"> if (state.lexical) {
</span><ins>+ // JavaScript
</ins><span class="cx"> debug += "Lexical: " + pad(String(state.lexical.type), 10); // JavaScript
</span><span class="cx"> debug += "Prev: " + pad(String(state.lexical.prev ? state.lexical.prev.type : state.lexical.prev), 10, !state.lexical.prev);
</span><ins>+ } else if (state.state) {
+ // CSS
+ debug += "State: " + pad(String(state.state), 16);
</ins><span class="cx"> }
</span><del>- else if (state.stack)
- debug += "Stack: " + pad(String(state.stack[state.stack.length-1]), 16); // CSS
</del><span class="cx">
</span><span class="cx"> // String
</span><span class="cx"> debug += "Current: '" + stream.current() + "'\n";
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIToolsPrettyPrintingcsstestsbasicexpectedcss"></a>
<div class="addfile"><h4>Added: trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/basic-expected.css (0 => 174323)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/basic-expected.css         (rev 0)
+++ trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/basic-expected.css        2014-10-04 22:11:57 UTC (rev 174323)
</span><span class="lines">@@ -0,0 +1,95 @@
</span><ins>+/* RESET */
+html, body, div, ul, ol, li, dl, dt, dd, h1, h2, h3, h4, h5, h6,
+pre, form, p, blockquote, fieldset, input, abbr, article, aside, command,
+details, figcaption, figure, footer, header, hgroup, mark, meter, nav,
+output, progress, section, summary, time {
+ margin: 0;
+ padding: 0;
+}
+
+h1, h2, h3, h4, h5, h6, pre, code, address, caption, cite, code, em, strong,
+th, figcaption {
+ font-size: 1em;
+ font-weight: normal;
+ font-style: normal;
+}
+
+fieldset, iframe {
+ border: none
+}
+
+table {
+ border-collapse: collapse;
+ border-spacing: 0
+}
+
+article, aside, footer, header, hgroup, nav, section, figure, figcaption {
+ display: block;
+}
+
+/* FIXME: extra whitespace */
+caption , th {
+ text-align: left;
+}
+
+/* IMPORTANT */
+/* FIXME: whitespace between "!" and "important" can be improved */
+body {
+ color: red !important;
+}
+
+body {
+ color: red !important;
+}
+
+body {
+ color: red ! important;
+}
+
+/* INLINE COMMENT */
+body {
+ color: red; /* blue */
+}
+
+/* URLS */
+.myimage {
+ background-image: url(http://example.com/image.png), url(two.png)
+}
+
+.myimage {
+ background-image: url("http://example.com/image.png"), url("two.png")
+}
+
+/* PREFIXED SELECTORS AND PROPERTIES */
+.foo -webkit-any(a, b, c) {
+ -webkit-transition: all;
+ color: red
+}
+
+/* PSEUDO SELECTORS */
+a:link, a:visited {
+ color: black
+}
+
+/* PSEUDO ELEMENTS */
+p::before, p::after {
+ content: "test";
+}
+
+/* RGB, HSL */
+body {
+ color: rgb(1, 1, 1);
+ color: rgba(100, 0, 255, 0.5);
+ color: hsl(120, 100%, 50%);
+ color: hsla(120, 60%, 70%, 0.3);
+}
+
+/*
+ * This is a multi-line comment.
+ * - with indentation
+ * - and is generally awesome.
+ */
+body {
+ color: red
+}
+
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIToolsPrettyPrintingcsstestsbasiccss"></a>
<div class="addfile"><h4>Added: trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/basic.css (0 => 174323)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/basic.css         (rev 0)
+++ trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/basic.css        2014-10-04 22:11:57 UTC (rev 174323)
</span><span class="lines">@@ -0,0 +1,41 @@
</span><ins>+/* RESET */
+html,body,div,ul,ol,li,dl,dt,dd,h1,h2,h3,h4,h5,h6,pre,form,p,blockquote,fieldset,input,abbr,article,aside,command,details,figcaption,figure,footer,header,hgroup,mark,meter,nav,output,progress,section,summary,time { margin: 0; padding: 0; }
+h1,h2,h3,h4,h5,h6,pre,code,address,caption,cite,code,em,strong,th,figcaption { font-size: 1em; font-weight: normal; font-style: normal; }
+fieldset,iframe{border:none}
+table{border-collapse:collapse;border-spacing:0}
+article,aside,footer,header,hgroup,nav,section,figure,figcaption{display: block;}
+
+/* FIXME: extra whitespace */
+caption , th { text-align: left; }
+
+/* IMPORTANT */
+/* FIXME: whitespace between "!" and "important" can be improved */
+body{color:red!important;}
+body{color:red !important;}
+body{color:red ! important;}
+
+/* INLINE COMMENT */
+body{color:red;/* blue */}
+
+/* URLS */
+.myimage{background-image:url(http://example.com/image.png),url(two.png)}
+.myimage{background-image:url("http://example.com/image.png"),url("two.png")}
+
+/* PREFIXED SELECTORS AND PROPERTIES */
+.foo -webkit-any(a,b,c){-webkit-transition:all;color:red}
+
+/* PSEUDO SELECTORS */
+a:link,a:visited{color:black}
+
+/* PSEUDO ELEMENTS */
+p::before,p::after{content:"test";}
+
+/* RGB, HSL */
+body{color:rgb(1,1,1);color:rgba(100,0,255,0.5);color:hsl(120,100%,50%);color:hsla(120,60%,70%,0.3);}
+
+/*
+ * This is a multi-line comment.
+ * - with indentation
+ * - and is generally awesome.
+ */
+body{color:red}
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIToolsPrettyPrintingcsstestscalcexpectedcss"></a>
<div class="addfile"><h4>Added: trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/calc-expected.css (0 => 174323)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/calc-expected.css         (rev 0)
+++ trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/calc-expected.css        2014-10-04 22:11:57 UTC (rev 174323)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+/* CALC EXPRESSIONS */
+/* FIXME: negative numbers can be improved */
+div {
+ width: -webkit-calc(100% + 80px + 1em);
+}
+
+div {
+ width: -webkit-calc(100% / 6);
+}
+
+div {
+ width: -webkit-calc(10% * 6);
+}
+
+div {
+ width: calc(-960px + 75%);
+}
+
+div {
+ width: calc(100vw-50vw);
+}
+
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIToolsPrettyPrintingcsstestscalccss"></a>
<div class="addfile"><h4>Added: trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/calc.css (0 => 174323)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/calc.css         (rev 0)
+++ trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/calc.css        2014-10-04 22:11:57 UTC (rev 174323)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+/* CALC EXPRESSIONS */
+/* FIXME: negative numbers can be improved */
+div{width:-webkit-calc(100%+80px+1em);}
+div{width:-webkit-calc(100%/6);}
+div{width:-webkit-calc(10%*6);}
+div{width:calc(-960px+75%);}
+div{width:calc(100vw-50vw);}
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIToolsPrettyPrintingcsstestsmediaqueryexpectedcss"></a>
<div class="addfile"><h4>Added: trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/media-query-expected.css (0 => 174323)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/media-query-expected.css         (rev 0)
+++ trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/media-query-expected.css        2014-10-04 22:11:57 UTC (rev 174323)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+/* MEDIA QUERY INDENTATION */
+@media print {
+ body, #main, #content {
+ color: #000 !important;
+ }
+
+ a, a:link, a:visited {
+ color: #000 !important;
+ text-decoration: none !important;
+ }
+
+ #tabs, #globalheader, #globalfooter, #directorynav, .noprint, .hide {
+ display: none !important;
+ }
+
+ #main a.pdf, #main a.html, #main a.qt, #main a.ical, #main a.dl, #main a.dmg,
+ #main a.zip, #main a.keynote, #main a.audio {
+ padding-left: 0;
+ background-image: none;
+ }
+}
+
+/* MEDIA QUERY */
+@media screen and (max-device-width:480px) {
+ html {
+ -webkit-text-size-adjust: none;
+ }
+}
+
+@media not ((screen) and (print)), (print) {
+ body {
+ color: red
+ }
+}
+
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIToolsPrettyPrintingcsstestsmediaquerycss"></a>
<div class="addfile"><h4>Added: trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/media-query.css (0 => 174323)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/media-query.css         (rev 0)
+++ trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/media-query.css        2014-10-04 22:11:57 UTC (rev 174323)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+/* MEDIA QUERY INDENTATION */
+@media print{body,#main,#content{color:#000!important;}a,a:link,a:visited{color:#000!important;text-decoration:none!important;}#tabs,#globalheader,#globalfooter,#directorynav,.noprint,.hide{display:none!important;}#main a.pdf,#main a.html,#main a.qt,#main a.ical,#main a.dl,#main a.dmg,#main a.zip,#main a.keynote,#main a.audio{padding-left:0;background-image:none;}}
+
+/* MEDIA QUERY */
+@media screen and(max-device-width:480px){html{-webkit-text-size-adjust:none;}}
+@media not((screen)and(print)),(print){body{color:red}}
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIToolsPrettyPrintingcsstestsselectorsexpectedcss"></a>
<div class="addfile"><h4>Added: trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/selectors-expected.css (0 => 174323)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/selectors-expected.css         (rev 0)
+++ trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/selectors-expected.css        2014-10-04 22:11:57 UTC (rev 174323)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+/* SHORT SELECTOR, EMPTY CONTENT */
+a {}
+
+/* COMPLEX SELECTOR */
+div div > div#id.foo.bar:hover .something > .child ~ .sibling + .sibling::after {
+ color: red;
+}
+
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIToolsPrettyPrintingcsstestsselectorscss"></a>
<div class="addfile"><h4>Added: trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/selectors.css (0 => 174323)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/selectors.css         (rev 0)
+++ trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/selectors.css        2014-10-04 22:11:57 UTC (rev 174323)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+/* SHORT SELECTOR, EMPTY CONTENT */
+a{}
+
+/* COMPLEX SELECTOR */
+div div>div#id.foo.bar:hover .something>.child~.sibling+.sibling::after{color:red;}
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIToolsPrettyPrintingindexhtml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/Tools/PrettyPrinting/index.html (174322 => 174323)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Tools/PrettyPrinting/index.html        2014-10-04 21:55:58 UTC (rev 174322)
+++ trunk/Source/WebInspectorUI/Tools/PrettyPrinting/index.html        2014-10-04 22:11:57 UTC (rev 174323)
</span><span class="lines">@@ -163,13 +163,11 @@
</span><span class="cx"> // Button helpers.
</span><span class="cx"> var buttons = ["mode", "populate", "run-tests", "clear", "select-output", "run-again"];
</span><span class="cx"> function disableButtons() {
</span><del>- console.log("disableButtons");
</del><span class="cx"> buttons.forEach(function(id) {
</span><span class="cx"> document.getElementById(id).disabled = true;
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx"> function enableButtons() {
</span><del>- console.log("enableButtons");
</del><span class="cx"> buttons.forEach(function(id) {
</span><span class="cx"> document.getElementById(id).disabled = false;
</span><span class="cx"> });
</span><span class="lines">@@ -243,7 +241,12 @@
</span><span class="cx"> ]);
</span><span class="cx"> }
</span><span class="cx"> function runCSSTests(callback) {
</span><del>- _runTests(callback, []);
</del><ins>+ _runTests(callback, [
+ "css-tests/basic.css",
+ "css-tests/calc.css",
+ "css-tests/media-query.css",
+ "css-tests/selectors.css",
+ ]);
</ins><span class="cx"> }
</span><span class="cx"> function _runTests(callback, manifest) {
</span><span class="cx"> var index = -1;
</span><span class="lines">@@ -264,7 +267,7 @@
</span><span class="cx">
</span><span class="cx"> // Load test and expected results.
</span><span class="cx"> var test = manifest[index];
</span><del>- var expected = test.replace(/\.js$/, "-expected.js");
</del><ins>+ var expected = test.replace(/\.([^\.]+)$/, "-expected.$1");
</ins><span class="cx"> var xhr1 = new XMLHttpRequest;
</span><span class="cx"> xhr1.open("GET", test, false);
</span><span class="cx"> xhr1.send();
</span><span class="lines">@@ -291,6 +294,16 @@
</span><span class="cx"> // Compare results.
</span><span class="cx"> var pass = builder.formattedContent === expectedData;
</span><span class="cx"> results.push("/* " + (pass ? "PASS" : "FAIL") + ": " + test + " */");
</span><ins>+
+ // Output failures to console.
+ if (!pass) {
+ console.log("Test", test, "Expected", expected);
+ console.log("Formatted Output", builder.formattedContent.length);
+ console.log(builder.formattedContent);
+ console.log("Expected Output", expectedData.length);
+ console.log(expectedData);
+ }
+
</ins><span class="cx"> runNextTest();
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsCodeMirrorFormattersjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorFormatters.js (174322 => 174323)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorFormatters.js        2014-10-04 21:55:58 UTC (rev 174322)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorFormatters.js        2014-10-04 22:11:57 UTC (rev 174323)
</span><span class="lines">@@ -300,7 +300,7 @@
</span><span class="cx"> if (!token) {
</span><span class="cx"> if (content === "{")
</span><span class="cx"> return true;
</span><del>- return false;
</del><ins>+ return ">+~-*/".indexOf(content) >= 0; // calc() expression or child/sibling selectors
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (isComment)
</span><span class="lines">@@ -322,12 +322,17 @@
</span><span class="cx"> return true;
</span><span class="cx"> if (lastContent === ":") // Space in "prop: value" but not in a selectors "a:link" or "div::after" or media queries "(max-device-width:480px)".
</span><span class="cx"> return state.state === "prop";
</span><del>- return false;
</del><ins>+ if (lastContent === ")" && (content !== ")" && content !== ",")) // Space in "not(foo)and" but not at the end of "not(not(foo))"
+ return state.state === "media" || state.state === "media_parens";
+ return ">+~-*/".indexOf(lastContent) >= 0; // calc() expression or child/sibling selectors
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (/\bcomment\b/.test(lastToken))
</span><span class="cx"> return true;
</span><span class="cx">
</span><ins>+ if (/\bkeyword\b/.test(lastToken)) // media-query keywords
+ return state.state === "media" || state.state === "media_parens";
+
</ins><span class="cx"> return false;
</span><span class="cx"> },
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>