- Revision
- 174482
- Author
- [email protected]
- Date
- 2014-10-08 17:08:44 -0700 (Wed, 08 Oct 2014)
Log Message
Web Inspector: CSS Pretty Printing fails to wrap long lines of selectors with pseudo classes/elements
https://bugs.webkit.org/show_bug.cgi?id=137413
Reviewed by Timothy Hatcher.
Long line wrapping was breaking as soon as there was a ':' for a psuedo
class or element. Likewise it was counting comment strings as part of
the length of the line even though it would get a newline after it.
* Tools/PrettyPrinting/CodeMirrorFormatters.js:
* Tools/PrettyPrinting/css-tests/basic-expected.css:
(progress, section, summary, time):
* Tools/PrettyPrinting/css-tests/wrapping-expected.css: Added.
(a.tryamacs, a.upgradenows):
(a.tryamacs:hover, a.upgradenows:hover):
* Tools/PrettyPrinting/css-tests/wrapping.css: Added.
(a.browsewebappss,a.businessstores,a.buyiphones,a.buynows,a.buynows-arrow,a.comingsoons,p::before,a.descargarahoras,a.downloadituness,a.downloadnows,a.finds,a.freetrials,a.getstarteds,a.gos,a.howtoapplys,a.howtobuys,a.joinnows,a.learnmores,a.nikebuynows,a.notifymes,a.ordernows,a.preordernows,a.preorders,a.reserves,a.startyoursearchs,a.submits,a.tryamacs,a.upgradenows):
(a.browsewebappss:hover,a.businessstores:hover,a.buyiphones:hover,a.buynows:hover,a.buynows-arrow:hover,a.comingsoons:hover,p::before,a.descargarahoras:hover,a.downloadituness:hover,a.downloadnows:hover,a.finds:hover,a.freetrials:hover,a.getstarteds:hover,a.gos:hover,a.howtoapplys:hover,a.howtobuys:hover,a.joinnows:hover,a.learnmores:hover,a.nikebuynows:hover,a.notifymes:hover,a.ordernows:hover,a.preordernows:hover,a.preorders:hover,a.reserves:hover,a.startyoursearchs:hover,a.submits:hover,a.tryamacs:hover,a.upgradenows:hover):
* Tools/PrettyPrinting/index.html:
* UserInterface/Views/CodeMirrorFormatters.js:
Modified Paths
Added Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (174481 => 174482)
--- trunk/Source/WebInspectorUI/ChangeLog 2014-10-08 23:37:58 UTC (rev 174481)
+++ trunk/Source/WebInspectorUI/ChangeLog 2014-10-09 00:08:44 UTC (rev 174482)
@@ -1,3 +1,26 @@
+2014-10-08 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: CSS Pretty Printing fails to wrap long lines of selectors with pseudo classes/elements
+ https://bugs.webkit.org/show_bug.cgi?id=137413
+
+ Reviewed by Timothy Hatcher.
+
+ Long line wrapping was breaking as soon as there was a ':' for a psuedo
+ class or element. Likewise it was counting comment strings as part of
+ the length of the line even though it would get a newline after it.
+
+ * Tools/PrettyPrinting/CodeMirrorFormatters.js:
+ * Tools/PrettyPrinting/css-tests/basic-expected.css:
+ (progress, section, summary, time):
+ * Tools/PrettyPrinting/css-tests/wrapping-expected.css: Added.
+ (a.tryamacs, a.upgradenows):
+ (a.tryamacs:hover, a.upgradenows:hover):
+ * Tools/PrettyPrinting/css-tests/wrapping.css: Added.
+ (a.browsewebappss,a.businessstores,a.buyiphones,a.buynows,a.buynows-arrow,a.comingsoons,p::before,a.descargarahoras,a.downloadituness,a.downloadnows,a.finds,a.freetrials,a.getstarteds,a.gos,a.howtoapplys,a.howtobuys,a.joinnows,a.learnmores,a.nikebuynows,a.notifymes,a.ordernows,a.preordernows,a.preorders,a.reserves,a.startyoursearchs,a.submits,a.tryamacs,a.upgradenows):
+ (a.browsewebappss:hover,a.businessstores:hover,a.buyiphones:hover,a.buynows:hover,a.buynows-arrow:hover,a.comingsoons:hover,p::before,a.descargarahoras:hover,a.downloadituness:hover,a.downloadnows:hover,a.finds:hover,a.freetrials:hover,a.getstarteds:hover,a.gos:hover,a.howtoapplys:hover,a.howtobuys:hover,a.joinnows:hover,a.learnmores:hover,a.nikebuynows:hover,a.notifymes:hover,a.ordernows:hover,a.preordernows:hover,a.preorders:hover,a.reserves:hover,a.startyoursearchs:hover,a.submits:hover,a.tryamacs:hover,a.upgradenows:hover):
+ * Tools/PrettyPrinting/index.html:
+ * UserInterface/Views/CodeMirrorFormatters.js:
+
2014-10-04 Joseph Pecoraro <[email protected]>
Web Inspector: Add PrettyPrinter CSS tests
Modified: trunk/Source/WebInspectorUI/Tools/PrettyPrinting/CodeMirrorFormatters.js (174481 => 174482)
--- trunk/Source/WebInspectorUI/Tools/PrettyPrinting/CodeMirrorFormatters.js 2014-10-08 23:37:58 UTC (rev 174481)
+++ trunk/Source/WebInspectorUI/Tools/PrettyPrinting/CodeMirrorFormatters.js 2014-10-09 00:08:44 UTC (rev 174482)
@@ -400,7 +400,7 @@
// In order insert newlines in selector lists we need keep track of the length of the current line.
// This isn't exact line length, only the builder knows that, but it is good enough to get an idea.
// If we are at a top level, keep track of the current line length, otherwise we reset to 0.
- if (state.state === "top" || state.state === "media")
+ if (!isComment && (state.state === "top" || state.state === "media" || state.state === "pseudo"))
state._cssPrettyPrint.lineLength += content.length;
else
state._cssPrettyPrint.lineLength = 0;
Modified: trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/basic-expected.css (174481 => 174482)
--- trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/basic-expected.css 2014-10-08 23:37:58 UTC (rev 174481)
+++ trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/basic-expected.css 2014-10-09 00:08:44 UTC (rev 174482)
@@ -1,8 +1,8 @@
/* 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 {
+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;
}
Added: trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/wrapping-expected.css (0 => 174482)
--- trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/wrapping-expected.css (rev 0)
+++ trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/wrapping-expected.css 2014-10-09 00:08:44 UTC (rev 174482)
@@ -0,0 +1,21 @@
+/* LONG LISTS SHOULD WRAP */
+a.browsewebappss, a.businessstores, a.buyiphones, a.buynows, a.buynows-arrow,
+a.comingsoons, p::before, a.descargarahoras, a.downloadituness, a.downloadnows,
+a.finds, a.freetrials, a.getstarteds, a.gos, a.howtoapplys, a.howtobuys,
+a.joinnows, a.learnmores, a.nikebuynows, a.notifymes, a.ordernows,
+a.preordernows, a.preorders, a.reserves, a.startyoursearchs, a.submits,
+a.tryamacs, a.upgradenows {
+ color: red
+}
+
+a.browsewebappss:hover, a.businessstores:hover, a.buyiphones:hover,
+a.buynows:hover, a.buynows-arrow:hover, a.comingsoons:hover, p::before,
+a.descargarahoras:hover, a.downloadituness:hover, a.downloadnows:hover,
+a.finds:hover, a.freetrials:hover, a.getstarteds:hover, a.gos:hover,
+a.howtoapplys:hover, a.howtobuys:hover, a.joinnows:hover, a.learnmores:hover,
+a.nikebuynows:hover, a.notifymes:hover, a.ordernows:hover, a.preordernows:hover,
+a.preorders:hover, a.reserves:hover, a.startyoursearchs:hover, a.submits:hover,
+a.tryamacs:hover, a.upgradenows:hover {
+ color: red
+}
+
Added: trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/wrapping.css (0 => 174482)
--- trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/wrapping.css (rev 0)
+++ trunk/Source/WebInspectorUI/Tools/PrettyPrinting/css-tests/wrapping.css 2014-10-09 00:08:44 UTC (rev 174482)
@@ -0,0 +1,3 @@
+/* LONG LISTS SHOULD WRAP */
+a.browsewebappss,a.businessstores,a.buyiphones,a.buynows,a.buynows-arrow,a.comingsoons,p::before,a.descargarahoras,a.downloadituness,a.downloadnows,a.finds,a.freetrials,a.getstarteds,a.gos,a.howtoapplys,a.howtobuys,a.joinnows,a.learnmores,a.nikebuynows,a.notifymes,a.ordernows,a.preordernows,a.preorders,a.reserves,a.startyoursearchs,a.submits,a.tryamacs,a.upgradenows {color:red}
+a.browsewebappss:hover,a.businessstores:hover,a.buyiphones:hover,a.buynows:hover,a.buynows-arrow:hover,a.comingsoons:hover,p::before,a.descargarahoras:hover,a.downloadituness:hover,a.downloadnows:hover,a.finds:hover,a.freetrials:hover,a.getstarteds:hover,a.gos:hover,a.howtoapplys:hover,a.howtobuys:hover,a.joinnows:hover,a.learnmores:hover,a.nikebuynows:hover,a.notifymes:hover,a.ordernows:hover,a.preordernows:hover,a.preorders:hover,a.reserves:hover,a.startyoursearchs:hover,a.submits:hover,a.tryamacs:hover,a.upgradenows:hover {color:red}
Modified: trunk/Source/WebInspectorUI/Tools/PrettyPrinting/index.html (174481 => 174482)
--- trunk/Source/WebInspectorUI/Tools/PrettyPrinting/index.html 2014-10-08 23:37:58 UTC (rev 174481)
+++ trunk/Source/WebInspectorUI/Tools/PrettyPrinting/index.html 2014-10-09 00:08:44 UTC (rev 174482)
@@ -246,6 +246,7 @@
"css-tests/calc.css",
"css-tests/media-query.css",
"css-tests/selectors.css",
+ "css-tests/wrapping.css",
]);
}
function _runTests(callback, manifest) {
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorFormatters.js (174481 => 174482)
--- trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorFormatters.js 2014-10-08 23:37:58 UTC (rev 174481)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorFormatters.js 2014-10-09 00:08:44 UTC (rev 174482)
@@ -400,7 +400,7 @@
// In order insert newlines in selector lists we need keep track of the length of the current line.
// This isn't exact line length, only the builder knows that, but it is good enough to get an idea.
// If we are at a top level, keep track of the current line length, otherwise we reset to 0.
- if (state.state === "top" || state.state === "media")
+ if (!isComment && (state.state === "top" || state.state === "media" || state.state === "pseudo"))
state._cssPrettyPrint.lineLength += content.length;
else
state._cssPrettyPrint.lineLength = 0;