Chromium Code Reviews| 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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 618 this.element.addEventListener('click', this._handleEmptySpaceClick.bind(this ), false); | 618 this.element.addEventListener('click', this._handleEmptySpaceClick.bind(this ), false); |
| 619 this.element.addEventListener('mousemove', this._onMouseMove.bind(this), fal se); | 619 this.element.addEventListener('mousemove', this._onMouseMove.bind(this), fal se); |
| 620 this.element.addEventListener('mouseleave', this._setSectionHovered.bind(thi s, false), false); | 620 this.element.addEventListener('mouseleave', this._setSectionHovered.bind(thi s, false), false); |
| 621 | 621 |
| 622 if (rule) { | 622 if (rule) { |
| 623 // Prevent editing the user agent and user rules. | 623 // Prevent editing the user agent and user rules. |
| 624 if (rule.isUserAgent() || rule.isInjected()) { | 624 if (rule.isUserAgent() || rule.isInjected()) { |
| 625 this.editable = false; | 625 this.editable = false; |
| 626 } else { | 626 } else { |
| 627 // Check this is a real CSSRule, not a bogus object coming from Elements .BlankStylePropertiesSection. | 627 // Check this is a real CSSRule, not a bogus object coming from Elements .BlankStylePropertiesSection. |
| 628 if (rule.styleSheetId) | 628 if (rule.styleSheetId) { |
| 629 this.navigable = !!rule.resourceURL(); | 629 var header = rule.cssModel().styleSheetHeaderForId(rule.styleSheetId); |
| 630 var hasSourceMap = header ? !!header.sourceMap() : false; | |
| 631 this.navigable = !!rule.resourceURL() || hasSourceMap; | |
|
dgozman
2016/12/04 03:13:13
Note: you can replace rule.resourceURL() with head
lushnikov
2016/12/05 19:56:38
Done.
| |
| 632 } | |
| 630 } | 633 } |
| 631 } | 634 } |
| 632 | 635 |
| 633 this._mediaListElement = this._titleElement.createChild('div', 'media-list m edia-matches'); | 636 this._mediaListElement = this._titleElement.createChild('div', 'media-list m edia-matches'); |
| 634 this._selectorRefElement = this._titleElement.createChild('div', 'styles-sec tion-subtitle'); | 637 this._selectorRefElement = this._titleElement.createChild('div', 'styles-sec tion-subtitle'); |
| 635 this._updateMediaList(); | 638 this._updateMediaList(); |
| 636 this._updateRuleOrigin(); | 639 this._updateRuleOrigin(); |
| 637 this._titleElement.appendChild(selectorContainer); | 640 this._titleElement.appendChild(selectorContainer); |
| 638 this._selectorContainer = selectorContainer; | 641 this._selectorContainer = selectorContainer; |
| 639 | 642 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 663 var ruleLocation; | 666 var ruleLocation; |
| 664 if (rule instanceof SDK.CSSStyleRule) { | 667 if (rule instanceof SDK.CSSStyleRule) { |
| 665 var matchingSelectors = matchedStyles.matchingSelectors(rule); | 668 var matchingSelectors = matchedStyles.matchingSelectors(rule); |
| 666 var firstMatchingIndex = matchingSelectors.length ? matchingSelectors[0] : 0; | 669 var firstMatchingIndex = matchingSelectors.length ? matchingSelectors[0] : 0; |
| 667 ruleLocation = rule.selectors[firstMatchingIndex].range; | 670 ruleLocation = rule.selectors[firstMatchingIndex].range; |
| 668 } else if (rule instanceof SDK.CSSKeyframeRule) { | 671 } else if (rule instanceof SDK.CSSKeyframeRule) { |
| 669 ruleLocation = rule.key().range; | 672 ruleLocation = rule.key().range; |
| 670 } | 673 } |
| 671 | 674 |
| 672 var header = rule.styleSheetId ? matchedStyles.cssModel().styleSheetHeaderFo rId(rule.styleSheetId) : null; | 675 var header = rule.styleSheetId ? matchedStyles.cssModel().styleSheetHeaderFo rId(rule.styleSheetId) : null; |
| 673 if (ruleLocation && rule.styleSheetId && header && header.resourceURL()) { | 676 if (ruleLocation && rule.styleSheetId && header && (header.resourceURL() || !!header.sourceMap())) { |
|
dgozman
2016/12/04 03:13:13
... and use it here.
lushnikov
2016/12/05 19:56:38
Done.
| |
| 674 return Elements.StylePropertiesSection._linkifyRuleLocation( | 677 return Elements.StylePropertiesSection._linkifyRuleLocation( |
| 675 matchedStyles.cssModel(), linkifier, rule.styleSheetId, ruleLocation); | 678 matchedStyles.cssModel(), linkifier, rule.styleSheetId, ruleLocation); |
| 676 } | 679 } |
| 677 | 680 |
| 678 if (rule.isUserAgent()) | 681 if (rule.isUserAgent()) |
| 679 return createTextNode(Common.UIString('user agent stylesheet')); | 682 return createTextNode(Common.UIString('user agent stylesheet')); |
| 680 if (rule.isInjected()) | 683 if (rule.isInjected()) |
| 681 return createTextNode(Common.UIString('injected stylesheet')); | 684 return createTextNode(Common.UIString('injected stylesheet')); |
| 682 if (rule.isViaInspector()) | 685 if (rule.isViaInspector()) |
| 683 return createTextNode(Common.UIString('via inspector')); | 686 return createTextNode(Common.UIString('via inspector')); |
| (...skipping 2375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3059 } | 3062 } |
| 3060 | 3063 |
| 3061 /** | 3064 /** |
| 3062 * @override | 3065 * @override |
| 3063 * @return {!UI.ToolbarItem} | 3066 * @return {!UI.ToolbarItem} |
| 3064 */ | 3067 */ |
| 3065 item() { | 3068 item() { |
| 3066 return this._button; | 3069 return this._button; |
| 3067 } | 3070 } |
| 3068 }; | 3071 }; |
| OLD | NEW |