| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1322 * @param {!WebInspector.TokenizerFactory} tokenizerFactory | 1322 * @param {!WebInspector.TokenizerFactory} tokenizerFactory |
| 1323 */ | 1323 */ |
| 1324 function processTokens(tokenizerFactory) | 1324 function processTokens(tokenizerFactory) |
| 1325 { | 1325 { |
| 1326 var tokenize = tokenizerFactory.createTokenizer("text/css"); | 1326 var tokenize = tokenizerFactory.createTokenizer("text/css"); |
| 1327 tokenize(styleText, processToken); | 1327 tokenize(styleText, processToken); |
| 1328 callback(result + (indentation ? "\n" + endIndentation : "")); | 1328 callback(result + (indentation ? "\n" + endIndentation : "")); |
| 1329 } | 1329 } |
| 1330 | 1330 |
| 1331 var lastWasSemicolon = true; | 1331 var lastWasSemicolon = true; |
| 1332 var lastWasMeta = false; |
| 1332 var insideProperty = false; | 1333 var insideProperty = false; |
| 1333 /** | 1334 /** |
| 1334 * @param {string} token | 1335 * @param {string} token |
| 1335 * @param {?string} tokenType | 1336 * @param {?string} tokenType |
| 1336 * @param {number} column | 1337 * @param {number} column |
| 1337 * @param {number} newColumn | 1338 * @param {number} newColumn |
| 1338 */ | 1339 */ |
| 1339 function processToken(token, tokenType, column, newColumn) | 1340 function processToken(token, tokenType, column, newColumn) |
| 1340 { | 1341 { |
| 1341 var isSemicolon = token === ";"; | 1342 var isSemicolon = token === ";"; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1354 return; | 1355 return; |
| 1355 if (tokenType === "css-comment" && token.includes(":") && token.incl
udes(";")) { | 1356 if (tokenType === "css-comment" && token.includes(":") && token.incl
udes(";")) { |
| 1356 result += "\n" + indentation + token; | 1357 result += "\n" + indentation + token; |
| 1357 insideProperty = false; | 1358 insideProperty = false; |
| 1358 return; | 1359 return; |
| 1359 } | 1360 } |
| 1360 | 1361 |
| 1361 if (isSemicolon) | 1362 if (isSemicolon) |
| 1362 insideProperty = false; | 1363 insideProperty = false; |
| 1363 | 1364 |
| 1364 if (tokenType === "css-tag") { | 1365 if (tokenType === "css-meta" || (tokenType === "css-tag" && !lastWas
Meta)) { |
| 1365 result += "\n" + indentation; | 1366 result += "\n" + indentation; |
| 1366 insideProperty = true; | 1367 insideProperty = true; |
| 1367 } | 1368 } |
| 1368 result += token; | 1369 result += token; |
| 1370 |
| 1371 lastWasMeta = tokenType === "css-meta"; |
| 1369 } | 1372 } |
| 1370 }, | 1373 }, |
| 1371 | 1374 |
| 1372 /** | 1375 /** |
| 1373 * @param {string} text | 1376 * @param {string} text |
| 1374 * @return {string} | 1377 * @return {string} |
| 1375 */ | 1378 */ |
| 1376 _detectIndentation: function(text) | 1379 _detectIndentation: function(text) |
| 1377 { | 1380 { |
| 1378 var lines = text.split("\n"); | 1381 var lines = text.split("\n"); |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1999 * @constructor | 2002 * @constructor |
| 2000 * @param {?WebInspector.CSSStyleDeclaration} inlineStyle | 2003 * @param {?WebInspector.CSSStyleDeclaration} inlineStyle |
| 2001 * @param {?WebInspector.CSSStyleDeclaration} attributesStyle | 2004 * @param {?WebInspector.CSSStyleDeclaration} attributesStyle |
| 2002 */ | 2005 */ |
| 2003 WebInspector.CSSStyleModel.InlineStyleResult = function(inlineStyle, attributesS
tyle) | 2006 WebInspector.CSSStyleModel.InlineStyleResult = function(inlineStyle, attributesS
tyle) |
| 2004 { | 2007 { |
| 2005 this.inlineStyle = inlineStyle; | 2008 this.inlineStyle = inlineStyle; |
| 2006 this.attributesStyle = attributesStyle; | 2009 this.attributesStyle = attributesStyle; |
| 2007 } | 2010 } |
| 2008 | 2011 |
| OLD | NEW |