| 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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 // Inline style has the greatest specificity. | 535 // Inline style has the greatest specificity. |
| 536 if (styles.inlineStyle && node.nodeType() === Node.ELEMENT_NODE) { | 536 if (styles.inlineStyle && node.nodeType() === Node.ELEMENT_NODE) { |
| 537 var model = cascade.appendModelFromStyle(styles.inlineStyle, "elemen
t.style"); | 537 var model = cascade.appendModelFromStyle(styles.inlineStyle, "elemen
t.style"); |
| 538 model.setIsAttribute(true); | 538 model.setIsAttribute(true); |
| 539 } | 539 } |
| 540 | 540 |
| 541 // Add rules in reverse order to match the cascade order. | 541 // Add rules in reverse order to match the cascade order. |
| 542 var addedAttributesStyle; | 542 var addedAttributesStyle; |
| 543 for (var i = styles.matchedCSSRules.length - 1; i >= 0; --i) { | 543 for (var i = styles.matchedCSSRules.length - 1; i >= 0; --i) { |
| 544 var rule = styles.matchedCSSRules[i]; | 544 var rule = styles.matchedCSSRules[i]; |
| 545 if ((rule.isInjected || rule.isUserAgent) && !addedAttributesStyle)
{ | 545 if ((rule.isInjected() || rule.isUserAgent()) && !addedAttributesSty
le) { |
| 546 // Show element's Style Attributes after all author rules. | 546 // Show element's Style Attributes after all author rules. |
| 547 addedAttributesStyle = true; | 547 addedAttributesStyle = true; |
| 548 addAttributesStyle(); | 548 addAttributesStyle(); |
| 549 } | 549 } |
| 550 cascade.appendModelFromRule(rule); | 550 cascade.appendModelFromRule(rule); |
| 551 } | 551 } |
| 552 | 552 |
| 553 if (!addedAttributesStyle) | 553 if (!addedAttributesStyle) |
| 554 addAttributesStyle(); | 554 addAttributesStyle(); |
| 555 | 555 |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 newRuleButton.title = WebInspector.UIString("Insert Style Rule"); | 997 newRuleButton.title = WebInspector.UIString("Insert Style Rule"); |
| 998 newRuleButton.addEventListener("click", this._onNewRuleClick.bind(this),
false); | 998 newRuleButton.addEventListener("click", this._onNewRuleClick.bind(this),
false); |
| 999 } | 999 } |
| 1000 | 1000 |
| 1001 this._selectorElement.addEventListener("click", this._handleSelectorClick.bi
nd(this), false); | 1001 this._selectorElement.addEventListener("click", this._handleSelectorClick.bi
nd(this), false); |
| 1002 this.element.addEventListener("mousedown", this._handleEmptySpaceMouseDown.b
ind(this), false); | 1002 this.element.addEventListener("mousedown", this._handleEmptySpaceMouseDown.b
ind(this), false); |
| 1003 this.element.addEventListener("click", this._handleEmptySpaceClick.bind(this
), false); | 1003 this.element.addEventListener("click", this._handleEmptySpaceClick.bind(this
), false); |
| 1004 | 1004 |
| 1005 if (rule) { | 1005 if (rule) { |
| 1006 // Prevent editing the user agent and user rules. | 1006 // Prevent editing the user agent and user rules. |
| 1007 if (rule.isUserAgent || rule.isInjected) { | 1007 if (rule.isUserAgent() || rule.isInjected()) { |
| 1008 this.editable = false; | 1008 this.editable = false; |
| 1009 } else { | 1009 } else { |
| 1010 // Check this is a real CSSRule, not a bogus object coming from WebI
nspector.BlankStylePropertiesSection. | 1010 // Check this is a real CSSRule, not a bogus object coming from WebI
nspector.BlankStylePropertiesSection. |
| 1011 if (rule.styleSheetId) | 1011 if (rule.styleSheetId) |
| 1012 this.navigable = !!rule.resourceURL(); | 1012 this.navigable = !!rule.resourceURL(); |
| 1013 } | 1013 } |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 this._selectorRefElement = createElementWithClass("div", "styles-section-sub
title"); | 1016 this._selectorRefElement = createElementWithClass("div", "styles-section-sub
title"); |
| 1017 this._mediaListElement = this._titleElement.createChild("div", "media-list m
edia-matches"); | 1017 this._mediaListElement = this._titleElement.createChild("div", "media-list m
edia-matches"); |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1702 if (!rule) | 1702 if (!rule) |
| 1703 return createTextNode(""); | 1703 return createTextNode(""); |
| 1704 | 1704 |
| 1705 var firstMatchingIndex = rule.matchingSelectors && rule.matchingSelectors.le
ngth ? rule.matchingSelectors[0] : 0; | 1705 var firstMatchingIndex = rule.matchingSelectors && rule.matchingSelectors.le
ngth ? rule.matchingSelectors[0] : 0; |
| 1706 var ruleLocation = rule.selectors[firstMatchingIndex].range; | 1706 var ruleLocation = rule.selectors[firstMatchingIndex].range; |
| 1707 | 1707 |
| 1708 var header = rule.styleSheetId ? cssModel.styleSheetHeaderForId(rule.styleSh
eetId) : null; | 1708 var header = rule.styleSheetId ? cssModel.styleSheetHeaderForId(rule.styleSh
eetId) : null; |
| 1709 if (ruleLocation && rule.styleSheetId && header && header.resourceURL()) | 1709 if (ruleLocation && rule.styleSheetId && header && header.resourceURL()) |
| 1710 return WebInspector.StylePropertiesSection._linkifyRuleLocation(cssModel
, linkifier, rule.styleSheetId, ruleLocation); | 1710 return WebInspector.StylePropertiesSection._linkifyRuleLocation(cssModel
, linkifier, rule.styleSheetId, ruleLocation); |
| 1711 | 1711 |
| 1712 if (rule.isUserAgent) | 1712 if (rule.isUserAgent()) |
| 1713 return createTextNode(WebInspector.UIString("user agent stylesheet")); | 1713 return createTextNode(WebInspector.UIString("user agent stylesheet")); |
| 1714 if (rule.isInjected) | 1714 if (rule.isInjected()) |
| 1715 return createTextNode(WebInspector.UIString("injected stylesheet")); | 1715 return createTextNode(WebInspector.UIString("injected stylesheet")); |
| 1716 if (rule.isViaInspector) | 1716 if (rule.isViaInspector()) |
| 1717 return createTextNode(WebInspector.UIString("via inspector")); | 1717 return createTextNode(WebInspector.UIString("via inspector")); |
| 1718 | 1718 |
| 1719 if (header && header.ownerNode) { | 1719 if (header && header.ownerNode) { |
| 1720 var link = WebInspector.DOMPresentationUtils.linkifyDeferredNodeReferenc
e(header.ownerNode); | 1720 var link = WebInspector.DOMPresentationUtils.linkifyDeferredNodeReferenc
e(header.ownerNode); |
| 1721 link.textContent = "<style>…</style>"; | 1721 link.textContent = "<style>…</style>"; |
| 1722 return link; | 1722 return link; |
| 1723 } | 1723 } |
| 1724 | 1724 |
| 1725 return createTextNode(""); | 1725 return createTextNode(""); |
| 1726 } | 1726 } |
| (...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3183 | 3183 |
| 3184 /** | 3184 /** |
| 3185 * @override | 3185 * @override |
| 3186 * @return {?WebInspector.ToolbarItem} | 3186 * @return {?WebInspector.ToolbarItem} |
| 3187 */ | 3187 */ |
| 3188 item: function() | 3188 item: function() |
| 3189 { | 3189 { |
| 3190 return this._button; | 3190 return this._button; |
| 3191 } | 3191 } |
| 3192 } | 3192 } |
| OLD | NEW |