There should be tests for CSS PrettyPrinting just as there are for JavaScript and HTML. INITIAL IDEAS FOR TESTS TO ADD - WebKit prefixed - Media queries - Long lines - Short lines - Comments - Long set of rules - Long rules - Short rules - Pseudo selectors - url() Others?
Glancing at the code for some of its edge cases: - !important (should have space before) - ":" // Space in "prop: value" but not in a selectors "a:link" or "div::after" or media queries "(max-device-width:480px)". - multiple rules on one line => 2 newlines between rule declarations. (basically a bunch of minified CSS) As long as we reduce multiple spaces to a single space we're doing pretty good because CSS enforces spaces between almost all tokens. Unlike JavaScript which has lots of operators that can be smashed together without spaces.
<rdar://problem/17351848>
Created attachment 239246 [details] [PATCH] Proposed Fix
Comment on attachment 239246 [details] [PATCH] Proposed Fix Clearing flags on attachment: 239246 Committed r174323: <http://trac.webkit.org/changeset/174323>
All reviewed patches have been landed. Closing bug.
Why aren't these done as layout tests or tool tests? Will anyone remember to run the tests?
(In reply to comment #6) > Why aren't these done as layout tests or tool tests? Will anyone remember to run the tests? That is a good point. These could become layout tests. They only need to be run when we update CodeMirror, which is rare. I originally just added these as part of the tool because it was what I used for debugging and development, so it was easy and useful. We can move these.