Web Inspector: Pretty print falsely triggers on some JS that wasn't minified
authornvasilyev@apple.com <nvasilyev@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Nov 2015 22:14:52 +0000 (22:14 +0000)
committernvasilyev@apple.com <nvasilyev@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Nov 2015 22:14:52 +0000 (22:14 +0000)
commit974107941d2d2bef04522b6f1699b352489ecbf0
treefac14be86e6a1e1beb26012e2ecc6dc804ba5a93
parentd92f88ae237af1c364e59f8f77af225d43cceeb3
Web Inspector: Pretty print falsely triggers on some JS that wasn't minified
https://bugs.webkit.org/show_bug.cgi?id=150876

Change the minification detection heuristic. Look for the ratio of whitespace to
non-whitespace characters in the first 5000 characters.

The previous heuristic looked for lines longer than 500 characters. Not only it was
slower on large unminified files, it also had a false positive on unminified codemirror.js.

Reviewed by Timothy Hatcher.

* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype._contentWillPopulate):
(WebInspector.SourceCodeTextEditor.prototype._isLikelyMinified):
Exit early if whitespace to non-whitespace ratio drops below 5%.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192076 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js