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 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._affectsNode = function(styleRule) | |
|
vsevik
2014/11/05 08:04:50
Let's name it _hasMatchingSelectors
lushnikov
2014/11/05 11:02:17
Done.
| |
| 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 624 }, | 632 }, |
| 625 | 633 |
| 626 _canAffectCurrentStyles: function(node) | 634 _canAffectCurrentStyles: function(node) |
| 627 { | 635 { |
| 628 return this._node && (this._node === node || node.parentNode === this._n ode.parentNode || node.isAncestor(this._node)); | 636 return this._node && (this._node === node || node.parentNode === this._n ode.parentNode || node.isAncestor(this._node)); |
| 629 }, | 637 }, |
| 630 | 638 |
| 631 _innerRefreshUpdate: function(node, computedStyle, editedSection) | 639 _innerRefreshUpdate: function(node, computedStyle, editedSection) |
| 632 { | 640 { |
| 633 for (var pseudoId in this.sections) { | 641 for (var pseudoId in this.sections) { |
| 634 var styleRules = this._refreshStyleRules(this.sections[pseudoId], co mputedStyle); | 642 var filteredSections = this.sections[pseudoId] ? this.sections[pseud oId].filter(nonBlankSections) : []; |
| 643 var styleRules = this._refreshStyleRules(filteredSections, computedS tyle); | |
| 635 var usedProperties = {}; | 644 var usedProperties = {}; |
| 636 this._markUsedProperties(styleRules, usedProperties); | 645 this._markUsedProperties(styleRules, usedProperties); |
| 637 this._refreshSectionsForStyleRules(styleRules, usedProperties, edite dSection); | 646 this._refreshSectionsForStyleRules(filteredSections, styleRules, use dProperties, editedSection); |
| 638 } | 647 } |
| 639 if (computedStyle) | 648 if (computedStyle) |
| 640 this.sections[0][0].rebuildComputedTrace(this.sections[0]); | 649 this.sections[0][0].rebuildComputedTrace(this.sections[0]); |
| 641 | 650 |
| 642 this._nodeStylesUpdatedForTest(node, false); | 651 this._nodeStylesUpdatedForTest(node, false); |
| 652 | |
| 653 /** | |
| 654 * @param {!WebInspector.PropertiesSection} section | |
| 655 * @return {boolean} | |
| 656 */ | |
| 657 function nonBlankSections(section) | |
| 658 { | |
| 659 return !section.isBlank; | |
| 660 } | |
| 643 }, | 661 }, |
| 644 | 662 |
| 645 _innerRebuildUpdate: function(node, styles) | 663 _innerRebuildUpdate: function(node, styles) |
| 646 { | 664 { |
| 647 this._sectionsContainer.removeChildren(); | 665 this._sectionsContainer.removeChildren(); |
| 648 this._computedStylePane.bodyElement.removeChildren(); | 666 this._computedStylePane.bodyElement.removeChildren(); |
| 649 this._linkifier.reset(); | 667 this._linkifier.reset(); |
| 650 | 668 |
| 651 var styleRules = this._rebuildStyleRules(node, styles); | 669 var styleRules = this._rebuildStyleRules(node, styles); |
| 652 var usedProperties = {}; | 670 var usedProperties = {}; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 684 { | 702 { |
| 685 // Tests override this method. | 703 // Tests override this method. |
| 686 }, | 704 }, |
| 687 | 705 |
| 688 _refreshStyleRules: function(sections, computedStyle) | 706 _refreshStyleRules: function(sections, computedStyle) |
| 689 { | 707 { |
| 690 var nodeComputedStyle = computedStyle; | 708 var nodeComputedStyle = computedStyle; |
| 691 var styleRules = []; | 709 var styleRules = []; |
| 692 for (var i = 0; sections && i < sections.length; ++i) { | 710 for (var i = 0; sections && i < sections.length; ++i) { |
| 693 var section = sections[i]; | 711 var section = sections[i]; |
| 694 if (section.isBlank) | |
| 695 continue; | |
| 696 if (section.computedStyle) | 712 if (section.computedStyle) |
| 697 section.styleRule.style = nodeComputedStyle; | 713 section.styleRule.style = nodeComputedStyle; |
| 698 var styleRule = { section: section, style: section.styleRule.style, computedStyle: section.computedStyle, rule: section.rule, editable: !!(section.s tyleRule.style && section.styleRule.style.styleSheetId), | 714 var styleRule = { style: section.styleRule.style, computedStyle: sec tion.computedStyle, rule: section.rule, editable: !!(section.styleRule.style && section.styleRule.style.styleSheetId), |
| 699 isAttribute: section.styleRule.isAttribute, isInherited: section .styleRule.isInherited, parentNode: section.styleRule.parentNode }; | 715 isAttribute: section.styleRule.isAttribute, isInherited: section .styleRule.isInherited, parentNode: section.styleRule.parentNode }; |
| 700 styleRules.push(styleRule); | 716 styleRules.push(styleRule); |
| 701 } | 717 } |
| 702 return styleRules; | 718 return styleRules; |
| 703 }, | 719 }, |
| 704 | 720 |
| 705 _rebuildStyleRules: function(node, styles) | 721 _rebuildStyleRules: function(node, styles) |
| 706 { | 722 { |
| 707 var nodeComputedStyle = styles.computedStyle; | 723 var nodeComputedStyle = styles.computedStyle; |
| 708 this.sections = {}; | 724 this.sections = {}; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 787 | 803 |
| 788 _markUsedProperties: function(styleRules, usedProperties) | 804 _markUsedProperties: function(styleRules, usedProperties) |
| 789 { | 805 { |
| 790 var foundImportantProperties = {}; | 806 var foundImportantProperties = {}; |
| 791 var propertyToEffectiveRule = {}; | 807 var propertyToEffectiveRule = {}; |
| 792 var inheritedPropertyToNode = {}; | 808 var inheritedPropertyToNode = {}; |
| 793 for (var i = 0; i < styleRules.length; ++i) { | 809 for (var i = 0; i < styleRules.length; ++i) { |
| 794 var styleRule = styleRules[i]; | 810 var styleRule = styleRules[i]; |
| 795 if (styleRule.computedStyle || styleRule.isStyleSeparator) | 811 if (styleRule.computedStyle || styleRule.isStyleSeparator) |
| 796 continue; | 812 continue; |
| 797 if (styleRule.section && styleRule.section.noAffect) | 813 if (!WebInspector.StylesSidebarPane._affectsNode(styleRule)) |
| 798 continue; | 814 continue; |
| 799 | 815 |
| 800 styleRule.usedProperties = {}; | 816 styleRule.usedProperties = {}; |
| 801 | 817 |
| 802 var style = styleRule.style; | 818 var style = styleRule.style; |
| 803 var allProperties = style.allProperties; | 819 var allProperties = style.allProperties; |
| 804 for (var j = 0; j < allProperties.length; ++j) { | 820 for (var j = 0; j < allProperties.length; ++j) { |
| 805 var property = allProperties[j]; | 821 var property = allProperties[j]; |
| 806 if (!property.isLive || !property.parsedOk) | 822 if (!property.isLive || !property.parsedOk) |
| 807 continue; | 823 continue; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 830 delete propertyToEffectiveRule[canonicalName].usedProper ties[canonicalName]; | 846 delete propertyToEffectiveRule[canonicalName].usedProper ties[canonicalName]; |
| 831 } | 847 } |
| 832 | 848 |
| 833 styleRule.usedProperties[canonicalName] = true; | 849 styleRule.usedProperties[canonicalName] = true; |
| 834 usedProperties[canonicalName] = true; | 850 usedProperties[canonicalName] = true; |
| 835 propertyToEffectiveRule[canonicalName] = styleRule; | 851 propertyToEffectiveRule[canonicalName] = styleRule; |
| 836 } | 852 } |
| 837 } | 853 } |
| 838 }, | 854 }, |
| 839 | 855 |
| 840 _refreshSectionsForStyleRules: function(styleRules, usedProperties, editedSe ction) | 856 _refreshSectionsForStyleRules: function(sections, styleRules, usedProperties , editedSection) |
| 841 { | 857 { |
| 842 // Walk the style rules and update the sections with new overloaded and used properties. | 858 // Walk the style rules and update the sections with new overloaded and used properties. |
| 843 for (var i = 0; i < styleRules.length; ++i) { | 859 for (var i = 0; i < styleRules.length; ++i) { |
| 844 var styleRule = styleRules[i]; | 860 var styleRule = styleRules[i]; |
| 845 var section = styleRule.section; | 861 var section = sections[i]; |
| 846 if (styleRule.computedStyle) { | 862 if (styleRule.computedStyle) { |
| 847 section._usedProperties = usedProperties; | 863 section._usedProperties = usedProperties; |
| 848 section.update(); | 864 section.update(); |
| 849 } else { | 865 } else { |
| 850 section._usedProperties = styleRule.usedProperties; | 866 section._usedProperties = styleRule.usedProperties; |
| 851 section.update(section === editedSection); | 867 section.update(section === editedSection); |
| 852 } | 868 } |
| 853 } | 869 } |
| 854 }, | 870 }, |
| 855 | 871 |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1425 return false; | 1441 return false; |
| 1426 }, | 1442 }, |
| 1427 | 1443 |
| 1428 /** | 1444 /** |
| 1429 * @param {string} propertyName | 1445 * @param {string} propertyName |
| 1430 * @param {boolean=} isShorthand | 1446 * @param {boolean=} isShorthand |
| 1431 * @return {boolean} | 1447 * @return {boolean} |
| 1432 */ | 1448 */ |
| 1433 isPropertyOverloaded: function(propertyName, isShorthand) | 1449 isPropertyOverloaded: function(propertyName, isShorthand) |
| 1434 { | 1450 { |
| 1435 if (!this._usedProperties || this.noAffect) | 1451 if (!this._usedProperties || !WebInspector.StylesSidebarPane._affectsNod e(this.styleRule)) |
| 1436 return false; | 1452 return false; |
| 1437 | 1453 |
| 1438 if (this.isInherited && !WebInspector.CSSMetadata.isPropertyInherited(pr opertyName)) { | 1454 if (this.isInherited && !WebInspector.CSSMetadata.isPropertyInherited(pr opertyName)) { |
| 1439 // In the inherited sections, only show overrides for the potentiall y inherited properties. | 1455 // In the inherited sections, only show overrides for the potentiall y inherited properties. |
| 1440 return false; | 1456 return false; |
| 1441 } | 1457 } |
| 1442 | 1458 |
| 1443 var canonicalName = WebInspector.CSSMetadata.canonicalPropertyName(prope rtyName); | 1459 var canonicalName = WebInspector.CSSMetadata.canonicalPropertyName(prope rtyName); |
| 1444 var used = (canonicalName in this._usedProperties); | 1460 var used = (canonicalName in this._usedProperties); |
| 1445 if (used || !isShorthand) | 1461 if (used || !isShorthand) |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1523 }, | 1539 }, |
| 1524 | 1540 |
| 1525 _afterUpdateFinishedForTest: function() | 1541 _afterUpdateFinishedForTest: function() |
| 1526 { | 1542 { |
| 1527 }, | 1543 }, |
| 1528 | 1544 |
| 1529 onpopulate: function() | 1545 onpopulate: function() |
| 1530 { | 1546 { |
| 1531 var style = this.styleRule.style; | 1547 var style = this.styleRule.style; |
| 1532 var allProperties = style.allProperties; | 1548 var allProperties = style.allProperties; |
| 1533 this.uniqueProperties = []; | |
| 1534 | 1549 |
| 1535 var styleHasEditableSource = this.editable && !!style.range; | 1550 var styleHasEditableSource = this.editable && !!style.range; |
| 1536 if (styleHasEditableSource) { | 1551 if (styleHasEditableSource) { |
| 1537 for (var i = 0; i < allProperties.length; ++i) { | 1552 for (var i = 0; i < allProperties.length; ++i) { |
| 1538 var property = allProperties[i]; | 1553 var property = allProperties[i]; |
| 1539 this.uniqueProperties.push(property); | |
| 1540 if (property.styleBased) | 1554 if (property.styleBased) |
| 1541 continue; | 1555 continue; |
| 1542 | 1556 |
| 1543 var isShorthand = !!WebInspector.CSSMetadata.cssPropertiesMetain fo.longhands(property.name); | 1557 var isShorthand = !!WebInspector.CSSMetadata.cssPropertiesMetain fo.longhands(property.name); |
| 1544 var inherited = this.isPropertyInherited(property.name); | 1558 var inherited = this.isPropertyInherited(property.name); |
| 1545 var overloaded = property.inactive || this.isPropertyOverloaded( property.name); | 1559 var overloaded = property.inactive || this.isPropertyOverloaded( property.name); |
| 1546 var item = new WebInspector.StylePropertyTreeElement(this._paren tPane, this.styleRule, style, property, isShorthand, inherited, overloaded); | 1560 var item = new WebInspector.StylePropertyTreeElement(this._paren tPane, this.styleRule, style, property, isShorthand, inherited, overloaded); |
| 1547 this.propertiesTreeOutline.appendChild(item); | 1561 this.propertiesTreeOutline.appendChild(item); |
| 1548 } | 1562 } |
| 1549 return; | 1563 return; |
| 1550 } | 1564 } |
| 1551 | 1565 |
| 1552 var generatedShorthands = {}; | 1566 var generatedShorthands = {}; |
| 1553 // For style-based properties, generate shorthands with values when poss ible. | 1567 // For style-based properties, generate shorthands with values when poss ible. |
| 1554 for (var i = 0; i < allProperties.length; ++i) { | 1568 for (var i = 0; i < allProperties.length; ++i) { |
| 1555 var property = allProperties[i]; | 1569 var property = allProperties[i]; |
| 1556 this.uniqueProperties.push(property); | |
| 1557 var isShorthand = !!WebInspector.CSSMetadata.cssPropertiesMetainfo.l onghands(property.name); | 1570 var isShorthand = !!WebInspector.CSSMetadata.cssPropertiesMetainfo.l onghands(property.name); |
| 1558 | 1571 |
| 1559 // For style-based properties, try generating shorthands. | 1572 // For style-based properties, try generating shorthands. |
| 1560 var shorthands = isShorthand ? null : WebInspector.CSSMetadata.cssPr opertiesMetainfo.shorthands(property.name); | 1573 var shorthands = isShorthand ? null : WebInspector.CSSMetadata.cssPr opertiesMetainfo.shorthands(property.name); |
| 1561 var shorthandPropertyAvailable = false; | 1574 var shorthandPropertyAvailable = false; |
| 1562 for (var j = 0; shorthands && !shorthandPropertyAvailable && j < sho rthands.length; ++j) { | 1575 for (var j = 0; shorthands && !shorthandPropertyAvailable && j < sho rthands.length; ++j) { |
| 1563 var shorthand = shorthands[j]; | 1576 var shorthand = shorthands[j]; |
| 1564 if (shorthand in generatedShorthands) { | 1577 if (shorthand in generatedShorthands) { |
| 1565 shorthandPropertyAvailable = true; | 1578 shorthandPropertyAvailable = true; |
| 1566 continue; // There already is a shorthand this longhands fa lls under. | 1579 continue; // There already is a shorthand this longhands fa lls under. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1611 }, | 1624 }, |
| 1612 | 1625 |
| 1613 _markSelectorMatches: function() | 1626 _markSelectorMatches: function() |
| 1614 { | 1627 { |
| 1615 var rule = this.styleRule.rule; | 1628 var rule = this.styleRule.rule; |
| 1616 if (!rule) | 1629 if (!rule) |
| 1617 return; | 1630 return; |
| 1618 | 1631 |
| 1619 var matchingSelectors = rule.matchingSelectors; | 1632 var matchingSelectors = rule.matchingSelectors; |
| 1620 // .selector is rendered as non-affecting selector by default. | 1633 // .selector is rendered as non-affecting selector by default. |
| 1621 if (this.noAffect || matchingSelectors) | 1634 if (!WebInspector.StylesSidebarPane._affectsNode(this.styleRule) || matc hingSelectors) |
| 1622 this._selectorElement.className = "selector"; | 1635 this._selectorElement.className = "selector"; |
| 1623 if (!matchingSelectors) | 1636 if (!matchingSelectors) |
| 1624 return; | 1637 return; |
| 1625 | 1638 |
| 1626 var selectors = rule.selectors; | 1639 var selectors = rule.selectors; |
| 1627 var fragment = createDocumentFragment(); | 1640 var fragment = createDocumentFragment(); |
| 1628 var currentMatch = 0; | 1641 var currentMatch = 0; |
| 1629 for (var i = 0; i < selectors.length ; ++i) { | 1642 for (var i = 0; i < selectors.length ; ++i) { |
| 1630 if (i) | 1643 if (i) |
| 1631 fragment.createTextChild(", "); | 1644 fragment.createTextChild(", "); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1873 | 1886 |
| 1874 var selectedNode = this._parentPane._node; | 1887 var selectedNode = this._parentPane._node; |
| 1875 | 1888 |
| 1876 /** | 1889 /** |
| 1877 * @param {!WebInspector.CSSRule} newRule | 1890 * @param {!WebInspector.CSSRule} newRule |
| 1878 * @this {WebInspector.StylePropertiesSection} | 1891 * @this {WebInspector.StylePropertiesSection} |
| 1879 */ | 1892 */ |
| 1880 function successCallback(newRule) | 1893 function successCallback(newRule) |
| 1881 { | 1894 { |
| 1882 var doesAffectSelectedNode = newRule.matchingSelectors.length > 0; | 1895 var doesAffectSelectedNode = newRule.matchingSelectors.length > 0; |
| 1883 if (!doesAffectSelectedNode) { | 1896 this.element.classList.toggle("no-affect", !doesAffectSelectedNode); |
| 1884 this.noAffect = true; | |
| 1885 this.element.classList.add("no-affect"); | |
| 1886 } else { | |
| 1887 delete this.noAffect; | |
| 1888 this.element.classList.remove("no-affect"); | |
| 1889 } | |
| 1890 | 1897 |
| 1891 var oldSelectorRange = this.rule.selectorRange; | 1898 var oldSelectorRange = this.rule.selectorRange; |
| 1892 this.rule = newRule; | 1899 this.rule = newRule; |
| 1893 this.styleRule = { section: this, style: newRule.style, selectorText : newRule.selectorText, media: newRule.media, rule: newRule }; | 1900 this.styleRule = { style: newRule.style, selectorText: newRule.selec torText, media: newRule.media, rule: newRule }; |
| 1894 | 1901 |
| 1895 this._parentPane.update(selectedNode); | 1902 this._parentPane.update(selectedNode); |
| 1896 this._parentPane._styleSheetRuleEdited(this.rule, oldSelectorRange, this.rule.selectorRange); | 1903 this._parentPane._styleSheetRuleEdited(this.rule, oldSelectorRange, this.rule.selectorRange); |
| 1897 | 1904 |
| 1898 finishOperationAndMoveEditor.call(this, moveDirection); | 1905 finishOperationAndMoveEditor.call(this, moveDirection); |
| 1899 } | 1906 } |
| 1900 | 1907 |
| 1901 /** | 1908 /** |
| 1902 * @this {WebInspector.StylePropertiesSection} | 1909 * @this {WebInspector.StylePropertiesSection} |
| 1903 */ | 1910 */ |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2048 name.textContent = WebInspector.UIString("Animation") + " " + th is._animationProperties[property]; | 2055 name.textContent = WebInspector.UIString("Animation") + " " + th is._animationProperties[property]; |
| 2049 treeElement.appendChild(new TreeElement(fragment, null, false)); | 2056 treeElement.appendChild(new TreeElement(fragment, null, false)); |
| 2050 } | 2057 } |
| 2051 } | 2058 } |
| 2052 | 2059 |
| 2053 for (var i = 0; i < sections.length; ++i) { | 2060 for (var i = 0; i < sections.length; ++i) { |
| 2054 var section = sections[i]; | 2061 var section = sections[i]; |
| 2055 if (section.computedStyle || section.isBlank) | 2062 if (section.computedStyle || section.isBlank) |
| 2056 continue; | 2063 continue; |
| 2057 | 2064 |
| 2058 for (var j = 0; j < section.uniqueProperties.length; ++j) { | 2065 var properties = section.styleRule.style.allProperties; |
| 2059 var property = section.uniqueProperties[j]; | 2066 for (var j = 0; j < properties.length; ++j) { |
| 2067 var property = properties[j]; | |
| 2060 if (property.disabled) | 2068 if (property.disabled) |
| 2061 continue; | 2069 continue; |
| 2062 if (section.isInherited && !WebInspector.CSSMetadata.isPropertyI nherited(property.name)) | 2070 if (section.isInherited && !WebInspector.CSSMetadata.isPropertyI nherited(property.name)) |
| 2063 continue; | 2071 continue; |
| 2064 | 2072 |
| 2065 var treeElement = this._propertyTreeElements[property.name.toLow erCase()]; | 2073 var treeElement = this._propertyTreeElements[property.name.toLow erCase()]; |
| 2066 if (treeElement) { | 2074 if (treeElement) { |
| 2067 var fragment = createDocumentFragment(); | 2075 var fragment = createDocumentFragment(); |
| 2068 var selector = fragment.createChild("span"); | 2076 var selector = fragment.createChild("span"); |
| 2069 selector.style.color = "gray"; | 2077 selector.style.color = "gray"; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2156 return; | 2164 return; |
| 2157 } | 2165 } |
| 2158 | 2166 |
| 2159 /** | 2167 /** |
| 2160 * @param {!WebInspector.CSSRule} newRule | 2168 * @param {!WebInspector.CSSRule} newRule |
| 2161 * @this {WebInspector.StylePropertiesSection} | 2169 * @this {WebInspector.StylePropertiesSection} |
| 2162 */ | 2170 */ |
| 2163 function successCallback(newRule) | 2171 function successCallback(newRule) |
| 2164 { | 2172 { |
| 2165 var doesSelectorAffectSelectedNode = newRule.matchingSelectors.lengt h > 0; | 2173 var doesSelectorAffectSelectedNode = newRule.matchingSelectors.lengt h > 0; |
| 2166 var styleRule = { media: newRule.media, section: this, style: newRul e.style, selectorText: newRule.selectorText, rule: newRule }; | 2174 var styleRule = { media: newRule.media, style: newRule.style, select orText: newRule.selectorText, rule: newRule }; |
| 2167 this._makeNormal(styleRule); | 2175 this._makeNormal(styleRule); |
| 2168 | 2176 |
| 2169 if (!doesSelectorAffectSelectedNode) { | 2177 if (!doesSelectorAffectSelectedNode) |
| 2170 this.noAffect = true; | |
| 2171 this.element.classList.add("no-affect"); | 2178 this.element.classList.add("no-affect"); |
| 2172 } | |
| 2173 | 2179 |
| 2174 var ruleTextLines = ruleText.split("\n"); | 2180 var ruleTextLines = ruleText.split("\n"); |
| 2175 var startLine = this._ruleLocation.startLine; | 2181 var startLine = this._ruleLocation.startLine; |
| 2176 var startColumn = this._ruleLocation.startColumn; | 2182 var startColumn = this._ruleLocation.startColumn; |
| 2177 var newRange = new WebInspector.TextRange(startLine, startColumn, st artLine + ruleTextLines.length - 1, startColumn + ruleTextLines[ruleTextLines.le ngth - 1].length); | 2183 var newRange = new WebInspector.TextRange(startLine, startColumn, st artLine + ruleTextLines.length - 1, startColumn + ruleTextLines[ruleTextLines.le ngth - 1].length); |
| 2178 this._parentPane._styleSheetRuleEdited(newRule, this._ruleLocation, newRange); | 2184 this._parentPane._styleSheetRuleEdited(newRule, this._ruleLocation, newRange); |
| 2179 | 2185 |
| 2180 this._updateRuleOrigin(); | 2186 this._updateRuleOrigin(); |
| 2181 this.expand(); | 2187 this.expand(); |
| 2182 if (this.element.parentElement) // Might have been detached already. | 2188 if (this.element.parentElement) // Might have been detached already. |
| (...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3657 if (userEnteredText && (userEnteredText === userEnteredText.toUpperCase( ))) { | 3663 if (userEnteredText && (userEnteredText === userEnteredText.toUpperCase( ))) { |
| 3658 for (var i = 0; i < results.length; ++i) | 3664 for (var i = 0; i < results.length; ++i) |
| 3659 results[i] = results[i].toUpperCase(); | 3665 results[i] = results[i].toUpperCase(); |
| 3660 } | 3666 } |
| 3661 var selectedIndex = this._cssCompletions.mostUsedOf(results); | 3667 var selectedIndex = this._cssCompletions.mostUsedOf(results); |
| 3662 completionsReadyCallback(results, selectedIndex); | 3668 completionsReadyCallback(results, selectedIndex); |
| 3663 }, | 3669 }, |
| 3664 | 3670 |
| 3665 __proto__: WebInspector.TextPrompt.prototype | 3671 __proto__: WebInspector.TextPrompt.prototype |
| 3666 } | 3672 } |
| OLD | NEW |