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 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1432 | 1432 |
1433 /** | 1433 /** |
1434 * @param {string} token | 1434 * @param {string} token |
1435 * @param {?string} tokenType | 1435 * @param {?string} tokenType |
1436 * @param {number} column | 1436 * @param {number} column |
1437 * @param {number} newColumn | 1437 * @param {number} newColumn |
1438 */ | 1438 */ |
1439 function processToken(token, tokenType, column, newColumn) | 1439 function processToken(token, tokenType, column, newColumn) |
1440 { | 1440 { |
1441 if (!insideProperty) { | 1441 if (!insideProperty) { |
1442 var isDisabledProperty = tokenType && tokenType.includes("css-co
mment") && token.includes(":"); | 1442 var disabledProperty = tokenType && tokenType.includes("css-comm
ent") && isDisabledProperty(token); |
1443 var isPropertyStart = tokenType && (tokenType.includes("css-meta
") || tokenType.includes("css-property") || tokenType.includes("css-variable-2")
); | 1443 var isPropertyStart = tokenType && (tokenType.includes("css-meta
") || tokenType.includes("css-property") || tokenType.includes("css-variable-2")
); |
1444 if (isDisabledProperty) { | 1444 if (disabledProperty) { |
1445 result = result.trimRight() + indentation + token; | 1445 result = result.trimRight() + indentation + token; |
1446 } else if (isPropertyStart) { | 1446 } else if (isPropertyStart) { |
1447 insideProperty = true; | 1447 insideProperty = true; |
1448 propertyText = token; | 1448 propertyText = token; |
1449 } else if (token !== ";") { | 1449 } else if (token !== ";") { |
1450 result += token; | 1450 result += token; |
1451 } | 1451 } |
1452 return; | 1452 return; |
1453 } | 1453 } |
1454 | 1454 |
1455 if (token === "}" || token === ";") { | 1455 if (token === "}" || token === ";") { |
1456 result = result.trimRight() + indentation + propertyText.trim()
+ ";"; | 1456 result = result.trimRight() + indentation + propertyText.trim()
+ ";"; |
1457 insideProperty = false; | 1457 insideProperty = false; |
1458 if (token === "}") | 1458 if (token === "}") |
1459 result += "}"; | 1459 result += "}"; |
1460 } else { | 1460 } else { |
1461 propertyText += token; | 1461 propertyText += token; |
1462 } | 1462 } |
1463 } | 1463 } |
| 1464 |
| 1465 /** |
| 1466 * @param {string} text |
| 1467 * @return {boolean} |
| 1468 */ |
| 1469 function isDisabledProperty(text) |
| 1470 { |
| 1471 var colon = text.indexOf(":"); |
| 1472 if (colon === -1) |
| 1473 return false; |
| 1474 var propertyName = text.substring(2, colon).trim(); |
| 1475 return WebInspector.CSSMetadata.isCSSPropertyName(propertyName); |
| 1476 } |
1464 }, | 1477 }, |
1465 | 1478 |
1466 /** | 1479 /** |
1467 * @param {string} text | 1480 * @param {string} text |
1468 * @return {string} | 1481 * @return {string} |
1469 */ | 1482 */ |
1470 _detectIndentation: function(text) | 1483 _detectIndentation: function(text) |
1471 { | 1484 { |
1472 var lines = text.split("\n"); | 1485 var lines = text.split("\n"); |
1473 if (lines.length < 2) | 1486 if (lines.length < 2) |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2380 * @constructor | 2393 * @constructor |
2381 * @param {?WebInspector.CSSStyleDeclaration} inlineStyle | 2394 * @param {?WebInspector.CSSStyleDeclaration} inlineStyle |
2382 * @param {?WebInspector.CSSStyleDeclaration} attributesStyle | 2395 * @param {?WebInspector.CSSStyleDeclaration} attributesStyle |
2383 */ | 2396 */ |
2384 WebInspector.CSSStyleModel.InlineStyleResult = function(inlineStyle, attributesS
tyle) | 2397 WebInspector.CSSStyleModel.InlineStyleResult = function(inlineStyle, attributesS
tyle) |
2385 { | 2398 { |
2386 this.inlineStyle = inlineStyle; | 2399 this.inlineStyle = inlineStyle; |
2387 this.attributesStyle = attributesStyle; | 2400 this.attributesStyle = attributesStyle; |
2388 } | 2401 } |
2389 | 2402 |
OLD | NEW |