| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 } | 452 } |
| 453 }, | 453 }, |
| 454 | 454 |
| 455 /** | 455 /** |
| 456 * @param {?WebInspector.CSSStyleSheetHeader} styleSheetHeader | 456 * @param {?WebInspector.CSSStyleSheetHeader} styleSheetHeader |
| 457 */ | 457 */ |
| 458 _createNewRuleInStyleSheet: function(styleSheetHeader) | 458 _createNewRuleInStyleSheet: function(styleSheetHeader) |
| 459 { | 459 { |
| 460 if (!styleSheetHeader) | 460 if (!styleSheetHeader) |
| 461 return; | 461 return; |
| 462 styleSheetHeader.requestContent(onStyleSheetContent.bind(this, styleShee
tHeader.id)); | 462 styleSheetHeader.requestContent().then(onStyleSheetContent.bind(this, st
yleSheetHeader.id)); |
| 463 | 463 |
| 464 /** | 464 /** |
| 465 * @param {string} styleSheetId | 465 * @param {string} styleSheetId |
| 466 * @param {string} text | 466 * @param {?string} text |
| 467 * @this {WebInspector.StylesSidebarPane} | 467 * @this {WebInspector.StylesSidebarPane} |
| 468 */ | 468 */ |
| 469 function onStyleSheetContent(styleSheetId, text) | 469 function onStyleSheetContent(styleSheetId, text) |
| 470 { | 470 { |
| 471 text = text || ""; |
| 471 var lines = text.split("\n"); | 472 var lines = text.split("\n"); |
| 472 var range = WebInspector.TextRange.createFromLocation(lines.length -
1, lines[lines.length - 1].length); | 473 var range = WebInspector.TextRange.createFromLocation(lines.length -
1, lines[lines.length - 1].length); |
| 473 this._addBlankSection(this._sectionBlocks[0].sections[0], styleSheet
Id, range); | 474 this._addBlankSection(this._sectionBlocks[0].sections[0], styleSheet
Id, range); |
| 474 } | 475 } |
| 475 }, | 476 }, |
| 476 | 477 |
| 477 /** | 478 /** |
| 478 * @param {!WebInspector.StylePropertiesSection} insertAfterSection | 479 * @param {!WebInspector.StylePropertiesSection} insertAfterSection |
| 479 * @param {string} styleSheetId | 480 * @param {string} styleSheetId |
| 480 * @param {!WebInspector.TextRange} ruleLocation | 481 * @param {!WebInspector.TextRange} ruleLocation |
| (...skipping 2471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2952 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, onNodeCha
nged); | 2953 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, onNodeCha
nged); |
| 2953 onNodeChanged(); | 2954 onNodeChanged(); |
| 2954 return button; | 2955 return button; |
| 2955 | 2956 |
| 2956 function onNodeChanged() | 2957 function onNodeChanged() |
| 2957 { | 2958 { |
| 2958 var node = WebInspector.context.flavor(WebInspector.DOMNode); | 2959 var node = WebInspector.context.flavor(WebInspector.DOMNode); |
| 2959 button.setEnabled(!!node); | 2960 button.setEnabled(!!node); |
| 2960 } | 2961 } |
| 2961 } | 2962 } |
| OLD | NEW |