| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 _styleSheetChanged: function(styleSheetId, majorChange) | 158 _styleSheetChanged: function(styleSheetId, majorChange) |
| 159 { | 159 { |
| 160 if (!majorChange || !styleSheetId) | 160 if (!majorChange || !styleSheetId) |
| 161 return; | 161 return; |
| 162 | 162 |
| 163 function callback(href, content) | 163 function callback(href, content) |
| 164 { | 164 { |
| 165 var resource = WebInspector.resourceManager.resourceForURL(href); | 165 var resource = WebInspector.resourceManager.resourceForURL(href); |
| 166 if (resource && resource.type === WebInspector.Resource.Type.Stylesh
eet) | 166 if (resource && resource.type === WebInspector.Resource.Type.Stylesh
eet) |
| 167 resource.content = content; | 167 resource.setContent(content, this._onRevert.bind(this, styleShee
tId)); |
| 168 } | 168 } |
| 169 InspectorBackend.getStyleSheetText2(styleSheetId, callback); | 169 InspectorBackend.getStyleSheetText2(styleSheetId, callback.bind(this)); |
| 170 }, |
| 171 |
| 172 _onRevert: function(styleSheetId, contentToRevertTo) |
| 173 { |
| 174 function callback(success) |
| 175 { |
| 176 this._styleSheetChanged(styleSheetId, true); |
| 177 } |
| 178 InspectorBackend.setStyleSheetText2(styleSheetId, contentToRevertTo, cal
lback.bind(this)); |
| 170 } | 179 } |
| 171 } | 180 } |
| 172 | 181 |
| 173 WebInspector.CSSStyleDeclaration = function(payload) | 182 WebInspector.CSSStyleDeclaration = function(payload) |
| 174 { | 183 { |
| 175 this.id = payload.styleId; | 184 this.id = payload.styleId; |
| 176 this.properties = payload.properties; | 185 this.properties = payload.properties; |
| 177 this._shorthandValues = payload.shorthandValues; | 186 this._shorthandValues = payload.shorthandValues; |
| 178 this._livePropertyMap = {}; // LIVE properties (source-based or style-based)
: { name -> CSSProperty } | 187 this._livePropertyMap = {}; // LIVE properties (source-based or style-based)
: { name -> CSSProperty } |
| 179 this._allProperties = []; // ALL properties: [ CSSProperty ] | 188 this._allProperties = []; // ALL properties: [ CSSProperty ] |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 userCallback(null); | 550 userCallback(null); |
| 542 else { | 551 else { |
| 543 userCallback(new WebInspector.CSSStyleSheet(styleSheetPayload)); | 552 userCallback(new WebInspector.CSSStyleSheet(styleSheetPayload)); |
| 544 WebInspector.cssModel._styleSheetChanged(this.id, true); | 553 WebInspector.cssModel._styleSheetChanged(this.id, true); |
| 545 } | 554 } |
| 546 } | 555 } |
| 547 | 556 |
| 548 InspectorBackend.setStyleSheetText2(this.id, newText, callback.bind(this
)); | 557 InspectorBackend.setStyleSheetText2(this.id, newText, callback.bind(this
)); |
| 549 } | 558 } |
| 550 } | 559 } |
| OLD | NEW |