X-Git-Url: https://git.webkit.org/?p=WebKit-https.git;a=blobdiff_plain;f=Source%2FWebInspectorUI%2FTools%2FPrettyPrinting%2FCodeMirrorFormatters.js;h=840c0b3ee90bd1a694860938b2372412d3d7c355;hp=81c8155e71275cc9902a60639cd46324dba0796b;hb=6d66460b5ab211c08b172dc9259d0b5b23304ad0;hpb=e850e70b28a89cae9dce4fe78769e69af2c99fc2 diff --git a/Source/WebInspectorUI/Tools/PrettyPrinting/CodeMirrorFormatters.js b/Source/WebInspectorUI/Tools/PrettyPrinting/CodeMirrorFormatters.js index 81c8155e7127..840c0b3ee90b 100644 --- a/Source/WebInspectorUI/Tools/PrettyPrinting/CodeMirrorFormatters.js +++ b/Source/WebInspectorUI/Tools/PrettyPrinting/CodeMirrorFormatters.js @@ -290,7 +290,7 @@ CodeMirror.extendMode("javascript", { } }); -CodeMirror.extendMode("css-base", { +CodeMirror.extendMode("css", { shouldHaveSpaceBeforeToken: function(lastToken, lastContent, token, state, content, isComment) { if (!token) { @@ -337,7 +337,7 @@ CodeMirror.extendMode("css-base", { if (content === ";") return 1; if (content === ",") { // "a,b,c,...,z{}" rule list at top level or in @media top level and only if the line length will be large. - if ((!state.stack.length || state.stack.lastValue === "@media{") && state._cssPrettyPrint.lineLength > 60) { + if ((!state.stack || !state.stack.length || state.stack.lastValue === "@media{") && state._cssPrettyPrint.lineLength > 60) { state._cssPrettyPrint.lineLength = 0; return 1; } @@ -395,7 +395,7 @@ CodeMirror.extendMode("css-base", { // 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.stack.length || state.stack.lastValue === "@media{") + if (!state.stack || !state.stack.length || state.stack.lastValue === "@media{") state._cssPrettyPrint.lineLength += content.length; else state._cssPrettyPrint.lineLength = 0;