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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 if (!matchingNodeIds) | 354 if (!matchingNodeIds) |
355 return; | 355 return; |
356 if (matchingNodeIds.indexOf(nodeId) !== -1) | 356 if (matchingNodeIds.indexOf(nodeId) !== -1) |
357 matchingSelectors.push(index); | 357 matchingSelectors.push(index); |
358 } | 358 } |
359 }, | 359 }, |
360 | 360 |
361 /** | 361 /** |
362 * @param {!CSSAgent.StyleSheetId} styleSheetId | 362 * @param {!CSSAgent.StyleSheetId} styleSheetId |
363 * @param {!WebInspector.DOMNode} node | 363 * @param {!WebInspector.DOMNode} node |
364 * @param {string} selector | 364 * @param {string} ruleText |
| 365 * @param {!WebInspector.TextRange} ruleLocation |
365 * @param {function(!WebInspector.CSSRule)} successCallback | 366 * @param {function(!WebInspector.CSSRule)} successCallback |
366 * @param {function()} failureCallback | 367 * @param {function()} failureCallback |
367 */ | 368 */ |
368 addRule: function(styleSheetId, node, selector, successCallback, failureCall
back) | 369 addRule: function(styleSheetId, node, ruleText, ruleLocation, successCallbac
k, failureCallback) |
369 { | 370 { |
370 this._pendingCommandsMajorState.push(true); | 371 this._pendingCommandsMajorState.push(true); |
371 this._agent.addRule(styleSheetId, selector, callback.bind(this)); | 372 this._agent.addRule(styleSheetId, ruleText, ruleLocation, callback.bind(
this)); |
372 | 373 |
373 /** | 374 /** |
374 * @param {?Protocol.Error} error | 375 * @param {?Protocol.Error} error |
375 * @param {!CSSAgent.CSSRule} rulePayload | 376 * @param {!CSSAgent.CSSRule} rulePayload |
376 * @this {WebInspector.CSSStyleModel} | 377 * @this {WebInspector.CSSStyleModel} |
377 */ | 378 */ |
378 function callback(error, rulePayload) | 379 function callback(error, rulePayload) |
379 { | 380 { |
380 this._pendingCommandsMajorState.pop(); | 381 this._pendingCommandsMajorState.pop(); |
381 if (error) { | 382 if (error) { |
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 * @return {string} | 1493 * @return {string} |
1493 */ | 1494 */ |
1494 _trimSourceURL: function(text) | 1495 _trimSourceURL: function(text) |
1495 { | 1496 { |
1496 var sourceURLRegex = /\n[\040\t]*\/\*[#@][\040\t]sourceURL=[\040\t]*([^\
s]*)[\040\t]*\*\/[\040\t]*$/mg; | 1497 var sourceURLRegex = /\n[\040\t]*\/\*[#@][\040\t]sourceURL=[\040\t]*([^\
s]*)[\040\t]*\*\/[\040\t]*$/mg; |
1497 return text.replace(sourceURLRegex, ""); | 1498 return text.replace(sourceURLRegex, ""); |
1498 }, | 1499 }, |
1499 | 1500 |
1500 /** | 1501 /** |
1501 * @override | 1502 * @override |
1502 * @param {function(?string)} callback | 1503 * @param {function(string)} callback |
1503 */ | 1504 */ |
1504 requestContent: function(callback) | 1505 requestContent: function(callback) |
1505 { | 1506 { |
1506 this._cssModel._agent.getStyleSheetText(this.id, textCallback.bind(this)
); | 1507 this._cssModel._agent.getStyleSheetText(this.id, textCallback.bind(this)
); |
1507 | 1508 |
1508 /** | 1509 /** |
1509 * @this {WebInspector.CSSStyleSheetHeader} | 1510 * @this {WebInspector.CSSStyleSheetHeader} |
1510 */ | 1511 */ |
1511 function textCallback(error, text) | 1512 function textCallback(error, text) |
1512 { | 1513 { |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1642 for (var i = 0; i < callbacks.length; ++i) | 1643 for (var i = 0; i < callbacks.length; ++i) |
1643 callbacks[i](computedStyle); | 1644 callbacks[i](computedStyle); |
1644 } | 1645 } |
1645 } | 1646 } |
1646 } | 1647 } |
1647 | 1648 |
1648 /** | 1649 /** |
1649 * @type {!WebInspector.CSSStyleModel} | 1650 * @type {!WebInspector.CSSStyleModel} |
1650 */ | 1651 */ |
1651 WebInspector.cssModel; | 1652 WebInspector.cssModel; |
OLD | NEW |