| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 format = (color.hasAlpha() ? cf.HSLA : cf.HSL); | 126 format = (color.hasAlpha() ? cf.HSLA : cf.HSL); |
| 127 else if (!color.hasAlpha()) | 127 else if (!color.hasAlpha()) |
| 128 format = (color.canBeShortHex() ? cf.ShortHEX : cf.HEX); | 128 format = (color.canBeShortHex() ? cf.ShortHEX : cf.HEX); |
| 129 else | 129 else |
| 130 format = cf.RGBA; | 130 format = cf.RGBA; |
| 131 | 131 |
| 132 return format; | 132 return format; |
| 133 } | 133 } |
| 134 | 134 |
| 135 /** | 135 /** |
| 136 * @return {boolean} |
| 137 */ |
| 138 WebInspector.StylesSidebarPane._hasMatchingSelectors = function(styleRule) |
| 139 { |
| 140 return styleRule.rule ? styleRule.rule.matchingSelectors.length > 0 : true; |
| 141 } |
| 142 |
| 143 /** |
| 136 * @param {!WebInspector.CSSProperty} property | 144 * @param {!WebInspector.CSSProperty} property |
| 137 */ | 145 */ |
| 138 WebInspector.StylesSidebarPane._ignoreErrorsForProperty = function(property) { | 146 WebInspector.StylesSidebarPane._ignoreErrorsForProperty = function(property) { |
| 139 function hasUnknownVendorPrefix(string) | 147 function hasUnknownVendorPrefix(string) |
| 140 { | 148 { |
| 141 return !string.startsWith("-webkit-") && /^[-_][\w\d]+-\w/.test(string); | 149 return !string.startsWith("-webkit-") && /^[-_][\w\d]+-\w/.test(string); |
| 142 } | 150 } |
| 143 | 151 |
| 144 var name = property.name.toLowerCase(); | 152 var name = property.name.toLowerCase(); |
| 145 | 153 |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 }, | 638 }, |
| 631 | 639 |
| 632 _canAffectCurrentStyles: function(node) | 640 _canAffectCurrentStyles: function(node) |
| 633 { | 641 { |
| 634 return this._node && (this._node === node || node.parentNode === this._n
ode.parentNode || node.isAncestor(this._node)); | 642 return this._node && (this._node === node || node.parentNode === this._n
ode.parentNode || node.isAncestor(this._node)); |
| 635 }, | 643 }, |
| 636 | 644 |
| 637 _innerRefreshUpdate: function(node, computedStyle, editedSection) | 645 _innerRefreshUpdate: function(node, computedStyle, editedSection) |
| 638 { | 646 { |
| 639 for (var pseudoId in this.sections) { | 647 for (var pseudoId in this.sections) { |
| 640 var styleRules = this._refreshStyleRules(this.sections[pseudoId], co
mputedStyle); | 648 var filteredSections = this.sections[pseudoId] ? this.sections[pseud
oId].filter(nonBlankSections) : []; |
| 649 var styleRules = this._refreshStyleRules(filteredSections, computedS
tyle); |
| 641 var usedProperties = {}; | 650 var usedProperties = {}; |
| 642 this._markUsedProperties(styleRules, usedProperties); | 651 this._markUsedProperties(styleRules, usedProperties); |
| 643 this._refreshSectionsForStyleRules(styleRules, usedProperties, edite
dSection); | 652 this._refreshSectionsForStyleRules(filteredSections, styleRules, use
dProperties, editedSection); |
| 644 } | 653 } |
| 645 if (computedStyle) | 654 if (computedStyle) |
| 646 this.sections[0][0].rebuildComputedTrace(this.sections[0]); | 655 this.sections[0][0].rebuildComputedTrace(this.sections[0]); |
| 647 | 656 |
| 648 this._nodeStylesUpdatedForTest(node, false); | 657 this._nodeStylesUpdatedForTest(node, false); |
| 658 |
| 659 /** |
| 660 * @param {!WebInspector.PropertiesSection} section |
| 661 * @return {boolean} |
| 662 */ |
| 663 function nonBlankSections(section) |
| 664 { |
| 665 return !section.isBlank; |
| 666 } |
| 649 }, | 667 }, |
| 650 | 668 |
| 651 _innerRebuildUpdate: function(node, styles) | 669 _innerRebuildUpdate: function(node, styles) |
| 652 { | 670 { |
| 653 this._sectionsContainer.removeChildren(); | 671 this._sectionsContainer.removeChildren(); |
| 654 this._computedStylePane.bodyElement.removeChildren(); | 672 this._computedStylePane.bodyElement.removeChildren(); |
| 655 this._linkifier.reset(); | 673 this._linkifier.reset(); |
| 656 | 674 |
| 657 var styleRules = this._rebuildStyleRules(node, styles); | 675 var styleRules = this._rebuildStyleRules(node, styles); |
| 658 var usedProperties = {}; | 676 var usedProperties = {}; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 { | 708 { |
| 691 // Tests override this method. | 709 // Tests override this method. |
| 692 }, | 710 }, |
| 693 | 711 |
| 694 _refreshStyleRules: function(sections, computedStyle) | 712 _refreshStyleRules: function(sections, computedStyle) |
| 695 { | 713 { |
| 696 var nodeComputedStyle = computedStyle; | 714 var nodeComputedStyle = computedStyle; |
| 697 var styleRules = []; | 715 var styleRules = []; |
| 698 for (var i = 0; sections && i < sections.length; ++i) { | 716 for (var i = 0; sections && i < sections.length; ++i) { |
| 699 var section = sections[i]; | 717 var section = sections[i]; |
| 700 if (section.isBlank) | |
| 701 continue; | |
| 702 if (section.computedStyle) | 718 if (section.computedStyle) |
| 703 section.styleRule.style = nodeComputedStyle; | 719 section.styleRule.style = nodeComputedStyle; |
| 704 var styleRule = { section: section, style: section.styleRule.style,
computedStyle: section.computedStyle, rule: section.rule, editable: !!(section.s
tyleRule.style && section.styleRule.style.styleSheetId), | 720 var styleRule = { style: section.styleRule.style, computedStyle: sec
tion.computedStyle, rule: section.rule, editable: !!(section.styleRule.style &&
section.styleRule.style.styleSheetId), |
| 705 isAttribute: section.styleRule.isAttribute, isInherited: section
.styleRule.isInherited, parentNode: section.styleRule.parentNode }; | 721 isAttribute: section.styleRule.isAttribute, isInherited: section
.styleRule.isInherited, parentNode: section.styleRule.parentNode }; |
| 706 styleRules.push(styleRule); | 722 styleRules.push(styleRule); |
| 707 } | 723 } |
| 708 return styleRules; | 724 return styleRules; |
| 709 }, | 725 }, |
| 710 | 726 |
| 711 _rebuildStyleRules: function(node, styles) | 727 _rebuildStyleRules: function(node, styles) |
| 712 { | 728 { |
| 713 var nodeComputedStyle = styles.computedStyle; | 729 var nodeComputedStyle = styles.computedStyle; |
| 714 this.sections = {}; | 730 this.sections = {}; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 | 809 |
| 794 _markUsedProperties: function(styleRules, usedProperties) | 810 _markUsedProperties: function(styleRules, usedProperties) |
| 795 { | 811 { |
| 796 var foundImportantProperties = {}; | 812 var foundImportantProperties = {}; |
| 797 var propertyToEffectiveRule = {}; | 813 var propertyToEffectiveRule = {}; |
| 798 var inheritedPropertyToNode = {}; | 814 var inheritedPropertyToNode = {}; |
| 799 for (var i = 0; i < styleRules.length; ++i) { | 815 for (var i = 0; i < styleRules.length; ++i) { |
| 800 var styleRule = styleRules[i]; | 816 var styleRule = styleRules[i]; |
| 801 if (styleRule.computedStyle || styleRule.isStyleSeparator) | 817 if (styleRule.computedStyle || styleRule.isStyleSeparator) |
| 802 continue; | 818 continue; |
| 803 if (styleRule.section && styleRule.section.noAffect) | 819 if (!WebInspector.StylesSidebarPane._hasMatchingSelectors(styleRule)
) |
| 804 continue; | 820 continue; |
| 805 | 821 |
| 806 styleRule.usedProperties = {}; | 822 styleRule.usedProperties = {}; |
| 807 | 823 |
| 808 var style = styleRule.style; | 824 var style = styleRule.style; |
| 809 var allProperties = style.allProperties; | 825 var allProperties = style.allProperties; |
| 810 for (var j = 0; j < allProperties.length; ++j) { | 826 for (var j = 0; j < allProperties.length; ++j) { |
| 811 var property = allProperties[j]; | 827 var property = allProperties[j]; |
| 812 if (!property.isLive || !property.parsedOk) | 828 if (!property.isLive || !property.parsedOk) |
| 813 continue; | 829 continue; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 836 delete propertyToEffectiveRule[canonicalName].usedProper
ties[canonicalName]; | 852 delete propertyToEffectiveRule[canonicalName].usedProper
ties[canonicalName]; |
| 837 } | 853 } |
| 838 | 854 |
| 839 styleRule.usedProperties[canonicalName] = true; | 855 styleRule.usedProperties[canonicalName] = true; |
| 840 usedProperties[canonicalName] = true; | 856 usedProperties[canonicalName] = true; |
| 841 propertyToEffectiveRule[canonicalName] = styleRule; | 857 propertyToEffectiveRule[canonicalName] = styleRule; |
| 842 } | 858 } |
| 843 } | 859 } |
| 844 }, | 860 }, |
| 845 | 861 |
| 846 _refreshSectionsForStyleRules: function(styleRules, usedProperties, editedSe
ction) | 862 _refreshSectionsForStyleRules: function(sections, styleRules, usedProperties
, editedSection) |
| 847 { | 863 { |
| 848 // Walk the style rules and update the sections with new overloaded and
used properties. | 864 // Walk the style rules and update the sections with new overloaded and
used properties. |
| 849 for (var i = 0; i < styleRules.length; ++i) { | 865 for (var i = 0; i < styleRules.length; ++i) { |
| 850 var styleRule = styleRules[i]; | 866 var styleRule = styleRules[i]; |
| 851 var section = styleRule.section; | 867 var section = sections[i]; |
| 852 if (styleRule.computedStyle) { | 868 if (styleRule.computedStyle) { |
| 853 section._usedProperties = usedProperties; | 869 section._usedProperties = usedProperties; |
| 854 section.update(); | 870 section.update(); |
| 855 } else { | 871 } else { |
| 856 section._usedProperties = styleRule.usedProperties; | 872 section._usedProperties = styleRule.usedProperties; |
| 857 section.update(section === editedSection); | 873 section.update(section === editedSection); |
| 858 } | 874 } |
| 859 } | 875 } |
| 860 }, | 876 }, |
| 861 | 877 |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1431 return false; | 1447 return false; |
| 1432 }, | 1448 }, |
| 1433 | 1449 |
| 1434 /** | 1450 /** |
| 1435 * @param {string} propertyName | 1451 * @param {string} propertyName |
| 1436 * @param {boolean=} isShorthand | 1452 * @param {boolean=} isShorthand |
| 1437 * @return {boolean} | 1453 * @return {boolean} |
| 1438 */ | 1454 */ |
| 1439 isPropertyOverloaded: function(propertyName, isShorthand) | 1455 isPropertyOverloaded: function(propertyName, isShorthand) |
| 1440 { | 1456 { |
| 1441 if (!this._usedProperties || this.noAffect) | 1457 if (!this._usedProperties || !WebInspector.StylesSidebarPane._hasMatchin
gSelectors(this.styleRule)) |
| 1442 return false; | 1458 return false; |
| 1443 | 1459 |
| 1444 if (this.isInherited && !WebInspector.CSSMetadata.isPropertyInherited(pr
opertyName)) { | 1460 if (this.isInherited && !WebInspector.CSSMetadata.isPropertyInherited(pr
opertyName)) { |
| 1445 // In the inherited sections, only show overrides for the potentiall
y inherited properties. | 1461 // In the inherited sections, only show overrides for the potentiall
y inherited properties. |
| 1446 return false; | 1462 return false; |
| 1447 } | 1463 } |
| 1448 | 1464 |
| 1449 var canonicalName = WebInspector.CSSMetadata.canonicalPropertyName(prope
rtyName); | 1465 var canonicalName = WebInspector.CSSMetadata.canonicalPropertyName(prope
rtyName); |
| 1450 var used = (canonicalName in this._usedProperties); | 1466 var used = (canonicalName in this._usedProperties); |
| 1451 if (used || !isShorthand) | 1467 if (used || !isShorthand) |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1529 }, | 1545 }, |
| 1530 | 1546 |
| 1531 _afterUpdateFinishedForTest: function() | 1547 _afterUpdateFinishedForTest: function() |
| 1532 { | 1548 { |
| 1533 }, | 1549 }, |
| 1534 | 1550 |
| 1535 onpopulate: function() | 1551 onpopulate: function() |
| 1536 { | 1552 { |
| 1537 var style = this.styleRule.style; | 1553 var style = this.styleRule.style; |
| 1538 var allProperties = style.allProperties; | 1554 var allProperties = style.allProperties; |
| 1539 this.uniqueProperties = []; | |
| 1540 | 1555 |
| 1541 var styleHasEditableSource = this.editable && !!style.range; | 1556 var styleHasEditableSource = this.editable && !!style.range; |
| 1542 if (styleHasEditableSource) { | 1557 if (styleHasEditableSource) { |
| 1543 for (var i = 0; i < allProperties.length; ++i) { | 1558 for (var i = 0; i < allProperties.length; ++i) { |
| 1544 var property = allProperties[i]; | 1559 var property = allProperties[i]; |
| 1545 this.uniqueProperties.push(property); | |
| 1546 if (property.styleBased) | 1560 if (property.styleBased) |
| 1547 continue; | 1561 continue; |
| 1548 | 1562 |
| 1549 var isShorthand = !!WebInspector.CSSMetadata.cssPropertiesMetain
fo.longhands(property.name); | 1563 var isShorthand = !!WebInspector.CSSMetadata.cssPropertiesMetain
fo.longhands(property.name); |
| 1550 var inherited = this.isPropertyInherited(property.name); | 1564 var inherited = this.isPropertyInherited(property.name); |
| 1551 var overloaded = property.inactive || this.isPropertyOverloaded(
property.name); | 1565 var overloaded = property.inactive || this.isPropertyOverloaded(
property.name); |
| 1552 var item = new WebInspector.StylePropertyTreeElement(this._paren
tPane, this.styleRule, style, property, isShorthand, inherited, overloaded); | 1566 var item = new WebInspector.StylePropertyTreeElement(this._paren
tPane, this.styleRule, style, property, isShorthand, inherited, overloaded); |
| 1553 this.propertiesTreeOutline.appendChild(item); | 1567 this.propertiesTreeOutline.appendChild(item); |
| 1554 } | 1568 } |
| 1555 return; | 1569 return; |
| 1556 } | 1570 } |
| 1557 | 1571 |
| 1558 var generatedShorthands = {}; | 1572 var generatedShorthands = {}; |
| 1559 // For style-based properties, generate shorthands with values when poss
ible. | 1573 // For style-based properties, generate shorthands with values when poss
ible. |
| 1560 for (var i = 0; i < allProperties.length; ++i) { | 1574 for (var i = 0; i < allProperties.length; ++i) { |
| 1561 var property = allProperties[i]; | 1575 var property = allProperties[i]; |
| 1562 this.uniqueProperties.push(property); | |
| 1563 var isShorthand = !!WebInspector.CSSMetadata.cssPropertiesMetainfo.l
onghands(property.name); | 1576 var isShorthand = !!WebInspector.CSSMetadata.cssPropertiesMetainfo.l
onghands(property.name); |
| 1564 | 1577 |
| 1565 // For style-based properties, try generating shorthands. | 1578 // For style-based properties, try generating shorthands. |
| 1566 var shorthands = isShorthand ? null : WebInspector.CSSMetadata.cssPr
opertiesMetainfo.shorthands(property.name); | 1579 var shorthands = isShorthand ? null : WebInspector.CSSMetadata.cssPr
opertiesMetainfo.shorthands(property.name); |
| 1567 var shorthandPropertyAvailable = false; | 1580 var shorthandPropertyAvailable = false; |
| 1568 for (var j = 0; shorthands && !shorthandPropertyAvailable && j < sho
rthands.length; ++j) { | 1581 for (var j = 0; shorthands && !shorthandPropertyAvailable && j < sho
rthands.length; ++j) { |
| 1569 var shorthand = shorthands[j]; | 1582 var shorthand = shorthands[j]; |
| 1570 if (shorthand in generatedShorthands) { | 1583 if (shorthand in generatedShorthands) { |
| 1571 shorthandPropertyAvailable = true; | 1584 shorthandPropertyAvailable = true; |
| 1572 continue; // There already is a shorthand this longhands fa
lls under. | 1585 continue; // There already is a shorthand this longhands fa
lls under. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1617 }, | 1630 }, |
| 1618 | 1631 |
| 1619 _markSelectorMatches: function() | 1632 _markSelectorMatches: function() |
| 1620 { | 1633 { |
| 1621 var rule = this.styleRule.rule; | 1634 var rule = this.styleRule.rule; |
| 1622 if (!rule) | 1635 if (!rule) |
| 1623 return; | 1636 return; |
| 1624 | 1637 |
| 1625 var matchingSelectors = rule.matchingSelectors; | 1638 var matchingSelectors = rule.matchingSelectors; |
| 1626 // .selector is rendered as non-affecting selector by default. | 1639 // .selector is rendered as non-affecting selector by default. |
| 1627 if (this.noAffect || matchingSelectors) | 1640 if (!WebInspector.StylesSidebarPane._hasMatchingSelectors(this.styleRule
) || matchingSelectors) |
| 1628 this._selectorElement.className = "selector"; | 1641 this._selectorElement.className = "selector"; |
| 1629 if (!matchingSelectors) | 1642 if (!matchingSelectors) |
| 1630 return; | 1643 return; |
| 1631 | 1644 |
| 1632 var selectors = rule.selectors; | 1645 var selectors = rule.selectors; |
| 1633 var fragment = createDocumentFragment(); | 1646 var fragment = createDocumentFragment(); |
| 1634 var currentMatch = 0; | 1647 var currentMatch = 0; |
| 1635 for (var i = 0; i < selectors.length ; ++i) { | 1648 for (var i = 0; i < selectors.length ; ++i) { |
| 1636 if (i) | 1649 if (i) |
| 1637 fragment.createTextChild(", "); | 1650 fragment.createTextChild(", "); |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1877 return; | 1890 return; |
| 1878 } | 1891 } |
| 1879 | 1892 |
| 1880 /** | 1893 /** |
| 1881 * @param {!WebInspector.CSSRule} newRule | 1894 * @param {!WebInspector.CSSRule} newRule |
| 1882 * @this {WebInspector.StylePropertiesSection} | 1895 * @this {WebInspector.StylePropertiesSection} |
| 1883 */ | 1896 */ |
| 1884 function successCallback(newRule) | 1897 function successCallback(newRule) |
| 1885 { | 1898 { |
| 1886 var doesAffectSelectedNode = newRule.matchingSelectors.length > 0; | 1899 var doesAffectSelectedNode = newRule.matchingSelectors.length > 0; |
| 1887 if (!doesAffectSelectedNode) { | 1900 this.element.classList.toggle("no-affect", !doesAffectSelectedNode); |
| 1888 this.noAffect = true; | |
| 1889 this.element.classList.add("no-affect"); | |
| 1890 } else { | |
| 1891 delete this.noAffect; | |
| 1892 this.element.classList.remove("no-affect"); | |
| 1893 } | |
| 1894 | 1901 |
| 1895 var oldSelectorRange = this.rule.selectorRange; | 1902 var oldSelectorRange = this.rule.selectorRange; |
| 1896 this.rule = newRule; | 1903 this.rule = newRule; |
| 1897 this.styleRule = { section: this, style: newRule.style, selectorText
: newRule.selectorText, media: newRule.media, rule: newRule }; | 1904 this.styleRule = { style: newRule.style, selectorText: newRule.selec
torText, media: newRule.media, rule: newRule }; |
| 1898 | 1905 |
| 1899 this._parentPane._refreshUpdate(this, false); | 1906 this._parentPane._refreshUpdate(this, false); |
| 1900 this._parentPane._styleSheetRuleEdited(this.rule, oldSelectorRange,
this.rule.selectorRange); | 1907 this._parentPane._styleSheetRuleEdited(this.rule, oldSelectorRange,
this.rule.selectorRange); |
| 1901 | 1908 |
| 1902 finishOperationAndMoveEditor.call(this, moveDirection); | 1909 finishOperationAndMoveEditor.call(this, moveDirection); |
| 1903 } | 1910 } |
| 1904 | 1911 |
| 1905 /** | 1912 /** |
| 1906 * @this {WebInspector.StylePropertiesSection} | 1913 * @this {WebInspector.StylePropertiesSection} |
| 1907 */ | 1914 */ |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2053 name.textContent = WebInspector.UIString("Animation") + " " + th
is._animationProperties[property]; | 2060 name.textContent = WebInspector.UIString("Animation") + " " + th
is._animationProperties[property]; |
| 2054 treeElement.appendChild(new TreeElement(fragment, null, false)); | 2061 treeElement.appendChild(new TreeElement(fragment, null, false)); |
| 2055 } | 2062 } |
| 2056 } | 2063 } |
| 2057 | 2064 |
| 2058 for (var i = 0; i < sections.length; ++i) { | 2065 for (var i = 0; i < sections.length; ++i) { |
| 2059 var section = sections[i]; | 2066 var section = sections[i]; |
| 2060 if (section.computedStyle || section.isBlank) | 2067 if (section.computedStyle || section.isBlank) |
| 2061 continue; | 2068 continue; |
| 2062 | 2069 |
| 2063 for (var j = 0; j < section.uniqueProperties.length; ++j) { | 2070 var properties = section.styleRule.style.allProperties; |
| 2064 var property = section.uniqueProperties[j]; | 2071 for (var j = 0; j < properties.length; ++j) { |
| 2072 var property = properties[j]; |
| 2065 if (property.disabled) | 2073 if (property.disabled) |
| 2066 continue; | 2074 continue; |
| 2067 if (section.isInherited && !WebInspector.CSSMetadata.isPropertyI
nherited(property.name)) | 2075 if (section.isInherited && !WebInspector.CSSMetadata.isPropertyI
nherited(property.name)) |
| 2068 continue; | 2076 continue; |
| 2069 | 2077 |
| 2070 var treeElement = this._propertyTreeElements[property.name.toLow
erCase()]; | 2078 var treeElement = this._propertyTreeElements[property.name.toLow
erCase()]; |
| 2071 if (treeElement) { | 2079 if (treeElement) { |
| 2072 var fragment = createDocumentFragment(); | 2080 var fragment = createDocumentFragment(); |
| 2073 var selector = fragment.createChild("span"); | 2081 var selector = fragment.createChild("span"); |
| 2074 selector.style.color = "gray"; | 2082 selector.style.color = "gray"; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2161 return; | 2169 return; |
| 2162 } | 2170 } |
| 2163 | 2171 |
| 2164 /** | 2172 /** |
| 2165 * @param {!WebInspector.CSSRule} newRule | 2173 * @param {!WebInspector.CSSRule} newRule |
| 2166 * @this {WebInspector.StylePropertiesSection} | 2174 * @this {WebInspector.StylePropertiesSection} |
| 2167 */ | 2175 */ |
| 2168 function successCallback(newRule) | 2176 function successCallback(newRule) |
| 2169 { | 2177 { |
| 2170 var doesSelectorAffectSelectedNode = newRule.matchingSelectors.lengt
h > 0; | 2178 var doesSelectorAffectSelectedNode = newRule.matchingSelectors.lengt
h > 0; |
| 2171 var styleRule = { media: newRule.media, section: this, style: newRul
e.style, selectorText: newRule.selectorText, rule: newRule }; | 2179 var styleRule = { media: newRule.media, style: newRule.style, select
orText: newRule.selectorText, rule: newRule }; |
| 2172 this._makeNormal(styleRule); | 2180 this._makeNormal(styleRule); |
| 2173 | 2181 |
| 2174 if (!doesSelectorAffectSelectedNode) { | 2182 if (!doesSelectorAffectSelectedNode) |
| 2175 this.noAffect = true; | |
| 2176 this.element.classList.add("no-affect"); | 2183 this.element.classList.add("no-affect"); |
| 2177 } | |
| 2178 | 2184 |
| 2179 var ruleTextLines = ruleText.split("\n"); | 2185 var ruleTextLines = ruleText.split("\n"); |
| 2180 var startLine = this._ruleLocation.startLine; | 2186 var startLine = this._ruleLocation.startLine; |
| 2181 var startColumn = this._ruleLocation.startColumn; | 2187 var startColumn = this._ruleLocation.startColumn; |
| 2182 var newRange = new WebInspector.TextRange(startLine, startColumn, st
artLine + ruleTextLines.length - 1, startColumn + ruleTextLines[ruleTextLines.le
ngth - 1].length); | 2188 var newRange = new WebInspector.TextRange(startLine, startColumn, st
artLine + ruleTextLines.length - 1, startColumn + ruleTextLines[ruleTextLines.le
ngth - 1].length); |
| 2183 this._parentPane._styleSheetRuleEdited(newRule, this._ruleLocation,
newRange); | 2189 this._parentPane._styleSheetRuleEdited(newRule, this._ruleLocation,
newRange); |
| 2184 | 2190 |
| 2185 this._updateRuleOrigin(); | 2191 this._updateRuleOrigin(); |
| 2186 this.expand(); | 2192 this.expand(); |
| 2187 if (this.element.parentElement) // Might have been detached already. | 2193 if (this.element.parentElement) // Might have been detached already. |
| (...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3662 if (userEnteredText && (userEnteredText === userEnteredText.toUpperCase(
))) { | 3668 if (userEnteredText && (userEnteredText === userEnteredText.toUpperCase(
))) { |
| 3663 for (var i = 0; i < results.length; ++i) | 3669 for (var i = 0; i < results.length; ++i) |
| 3664 results[i] = results[i].toUpperCase(); | 3670 results[i] = results[i].toUpperCase(); |
| 3665 } | 3671 } |
| 3666 var selectedIndex = this._cssCompletions.mostUsedOf(results); | 3672 var selectedIndex = this._cssCompletions.mostUsedOf(results); |
| 3667 completionsReadyCallback(results, selectedIndex); | 3673 completionsReadyCallback(results, selectedIndex); |
| 3668 }, | 3674 }, |
| 3669 | 3675 |
| 3670 __proto__: WebInspector.TextPrompt.prototype | 3676 __proto__: WebInspector.TextPrompt.prototype |
| 3671 } | 3677 } |
| OLD | NEW |