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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 this.titleElement.appendChild(this._elementStateButton); | 44 this.titleElement.appendChild(this._elementStateButton); |
| 45 | 45 |
| 46 var addButton = document.createElement("button"); | 46 var addButton = document.createElement("button"); |
| 47 addButton.className = "pane-title-button add"; | 47 addButton.className = "pane-title-button add"; |
| 48 addButton.id = "add-style-button-test-id"; | 48 addButton.id = "add-style-button-test-id"; |
| 49 addButton.title = WebInspector.UIString("New Style Rule"); | 49 addButton.title = WebInspector.UIString("New Style Rule"); |
| 50 addButton.addEventListener("click", this._createNewRule.bind(this), false); | 50 addButton.addEventListener("click", this._createNewRule.bind(this), false); |
| 51 this.titleElement.appendChild(addButton); | 51 this.titleElement.appendChild(addButton); |
| 52 | 52 |
| 53 this._computedStylePane = computedStylePane; | 53 this._computedStylePane = computedStylePane; |
| 54 computedStylePane._stylesSidebarPane = this; | 54 computedStylePane.setHostingPane(this); |
| 55 this._setPseudoClassCallback = setPseudoClassCallback; | 55 this._setPseudoClassCallback = setPseudoClassCallback; |
| 56 this.element.addEventListener("contextmenu", this._contextMenuEventFired.bin d(this), true); | 56 this.element.addEventListener("contextmenu", this._contextMenuEventFired.bin d(this), true); |
| 57 WebInspector.settings.colorFormat.addChangeListener(this._colorFormatSetting Changed.bind(this)); | 57 WebInspector.settings.colorFormat.addChangeListener(this._colorFormatSetting Changed.bind(this)); |
| 58 | 58 |
| 59 this._createElementStatePane(); | 59 this._createElementStatePane(); |
| 60 this.bodyElement.appendChild(this._elementStatePane); | 60 this.bodyElement.appendChild(this._elementStatePane); |
| 61 this._sectionsContainer = document.createElement("div"); | 61 this._sectionsContainer = document.createElement("div"); |
| 62 this.bodyElement.appendChild(this._sectionsContainer); | 62 this.bodyElement.appendChild(this._sectionsContainer); |
| 63 | 63 |
| 64 this._spectrumHelper = new WebInspector.SpectrumPopupHelper(); | 64 this._spectrumHelper = new WebInspector.SpectrumPopupHelper(); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 */ | 173 */ |
| 174 _contextMenuEventFired: function(event) | 174 _contextMenuEventFired: function(event) |
| 175 { | 175 { |
| 176 // We start editing upon click -> default navigation to resources panel is not available | 176 // We start editing upon click -> default navigation to resources panel is not available |
| 177 // Hence we add a soft context menu for hrefs. | 177 // Hence we add a soft context menu for hrefs. |
| 178 var contextMenu = new WebInspector.ContextMenu(event); | 178 var contextMenu = new WebInspector.ContextMenu(event); |
| 179 contextMenu.appendApplicableItems(/** @type {!Node} */ (event.target)); | 179 contextMenu.appendApplicableItems(/** @type {!Node} */ (event.target)); |
| 180 contextMenu.show(); | 180 contextMenu.show(); |
| 181 }, | 181 }, |
| 182 | 182 |
| 183 /** | |
| 184 * @param {!Element} matchedStylesElement | |
| 185 * @param {!Element} computedStylesElement | |
| 186 */ | |
| 187 setFilterBoxContainers: function(matchedStylesElement, computedStylesElement ) | |
| 188 { | |
| 189 matchedStylesElement.appendChild(this._createCSSFilterControl()); | |
| 190 this._computedStylePane.setFilterBoxContainer(computedStylesElement); | |
| 191 }, | |
| 192 | |
| 193 /** | |
| 194 * @return {!Element} | |
| 195 */ | |
| 196 _createCSSFilterControl: function() | |
| 197 { | |
| 198 var filterInput = this._createPropertyFilterElement(false, searchHandler .bind(this)); | |
| 199 | |
| 200 /** | |
| 201 * @param {?RegExp} regex | |
| 202 * @this {WebInspector.StylesSidebarPane} | |
| 203 */ | |
| 204 function searchHandler(regex) | |
| 205 { | |
| 206 this._filterRegex = regex; | |
| 207 } | |
| 208 | |
| 209 filterInput.addEventListener("keydown", tabHandler.bind(this), false); | |
| 210 | |
| 211 /** | |
| 212 * @param {?Event} event | |
| 213 * @this {WebInspector.StylesSidebarPane} | |
| 214 */ | |
| 215 function tabHandler(event) | |
|
pfeldman
2014/03/13 05:33:53
It seems like editingCommitted is already implemen
apavlov
2014/03/13 16:28:15
Correct. Reused the logic.
| |
| 216 { | |
| 217 if (event.keyIdentifier !== "U+0009") | |
| 218 return; | |
| 219 | |
| 220 event.consume(true); | |
| 221 var firstSection = this.sections[0][1]; | |
| 222 if (!firstSection) | |
| 223 return; | |
| 224 if (event.shiftKey) { | |
| 225 var lastSection = firstSection.previousEditableSibling(); | |
| 226 if (!lastSection) | |
| 227 return; | |
| 228 lastSection.addNewBlankProperty().startEditing(); | |
| 229 } else { | |
| 230 if (firstSection.rule) | |
| 231 firstSection.startEditingSelector(); | |
| 232 else | |
| 233 firstSection._moveEditorFromSelector("forward"); | |
| 234 } | |
| 235 } | |
| 236 return filterInput; | |
| 237 }, | |
| 238 | |
| 183 get _forcedPseudoClasses() | 239 get _forcedPseudoClasses() |
| 184 { | 240 { |
| 185 return this.node ? (this.node.getUserProperty("pseudoState") || undefine d) : undefined; | 241 return this.node ? (this.node.getUserProperty("pseudoState") || undefine d) : undefined; |
| 186 }, | 242 }, |
| 187 | 243 |
| 188 _updateForcedPseudoStateInputs: function() | 244 _updateForcedPseudoStateInputs: function() |
| 189 { | 245 { |
| 190 if (!this.node) | 246 if (!this.node) |
| 191 return; | 247 return; |
| 192 | 248 |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 800 input.type = "checkbox"; | 856 input.type = "checkbox"; |
| 801 input.state = state; | 857 input.state = state; |
| 802 input.addEventListener("click", clickListener.bind(this), false); | 858 input.addEventListener("click", clickListener.bind(this), false); |
| 803 inputs.push(input); | 859 inputs.push(input); |
| 804 label.appendChild(input); | 860 label.appendChild(input); |
| 805 label.appendChild(document.createTextNode(":" + state)); | 861 label.appendChild(document.createTextNode(":" + state)); |
| 806 td.appendChild(label); | 862 td.appendChild(label); |
| 807 return td; | 863 return td; |
| 808 } | 864 } |
| 809 | 865 |
| 810 var tr = document.createElement("tr"); | 866 var tr = table.createChild("tr"); |
| 811 tr.appendChild(createCheckbox.call(this, "active")); | 867 tr.appendChild(createCheckbox.call(this, "active")); |
| 812 tr.appendChild(createCheckbox.call(this, "hover")); | 868 tr.appendChild(createCheckbox.call(this, "hover")); |
| 813 table.appendChild(tr); | |
| 814 | 869 |
| 815 tr = document.createElement("tr"); | 870 tr = table.createChild("tr"); |
| 816 tr.appendChild(createCheckbox.call(this, "focus")); | 871 tr.appendChild(createCheckbox.call(this, "focus")); |
| 817 tr.appendChild(createCheckbox.call(this, "visited")); | 872 tr.appendChild(createCheckbox.call(this, "visited")); |
| 818 table.appendChild(tr); | |
| 819 | 873 |
| 820 this._elementStatePane.appendChild(table); | 874 this._elementStatePane.appendChild(table); |
| 821 }, | 875 }, |
| 822 | 876 |
| 823 /** | 877 /** |
| 878 * @return {?RegExp} | |
| 879 */ | |
| 880 filterRegex: function() | |
| 881 { | |
| 882 return this._filterRegex; | |
| 883 }, | |
| 884 | |
| 885 /** | |
| 886 * @param {boolean} isComputedStyleFilter | |
| 887 * @return {!Element} | |
| 888 * @param {function(?RegExp)} filterCallback | |
| 889 */ | |
| 890 _createPropertyFilterElement: function(isComputedStyleFilter, filterCallback ) | |
| 891 { | |
| 892 var input = document.createElement("input"); | |
| 893 input.type = "text"; | |
| 894 input.placeholder = isComputedStyleFilter ? WebInspector.UIString("Filte r") : WebInspector.UIString("Find in Styles"); | |
| 895 input.className = "filter-box toolbar-search-control search-replace"; | |
|
pfeldman
2014/03/13 05:33:53
You are using styles that can change independently
apavlov
2014/03/13 16:28:15
I'm sharing styles with other search controls, so
| |
| 896 var boundSearchHandler = searchHandler.bind(this); | |
| 897 | |
| 898 /** | |
| 899 * @this {WebInspector.StylesSidebarPane} | |
| 900 */ | |
| 901 function searchHandler() | |
| 902 { | |
| 903 var regex = input.value ? new RegExp(input.value.escapeForRegExp(), "i") : null; | |
| 904 filterCallback(regex); | |
| 905 this._updateFilter(isComputedStyleFilter); | |
| 906 } | |
| 907 input.addEventListener("input", boundSearchHandler, false); | |
| 908 | |
| 909 /** | |
| 910 * @param {?Event} event | |
| 911 */ | |
| 912 function keydownHandler(event) | |
| 913 { | |
| 914 if (event.keyIdentifier !== "U+001B" || !input.value) | |
|
pfeldman
2014/03/13 05:33:53
What is 1B?
apavlov
2014/03/13 16:28:15
It's "Esc". I'll create a separate var for this.
| |
| 915 return; | |
| 916 event.consume(true); | |
| 917 input.value = ""; | |
| 918 boundSearchHandler(); | |
| 919 } | |
| 920 input.addEventListener("keydown", keydownHandler, false); | |
| 921 | |
| 922 return input; | |
| 923 }, | |
| 924 | |
| 925 /** | |
| 926 * @param {boolean} isComputedStyleFilter | |
| 927 */ | |
| 928 _updateFilter: function(isComputedStyleFilter) | |
| 929 { | |
| 930 for (var pseudoId in this.sections) { | |
| 931 var sections = this.sections[pseudoId]; | |
| 932 for (var i = 0; i < sections.length; ++i) { | |
| 933 var section = sections[i]; | |
| 934 if (isComputedStyleFilter !== !!section.computedStyle) | |
| 935 continue; | |
| 936 section.updateFilter(); | |
| 937 } | |
| 938 } | |
| 939 }, | |
| 940 | |
| 941 /** | |
| 824 * @param {!WebInspector.Event} event | 942 * @param {!WebInspector.Event} event |
| 825 */ | 943 */ |
| 826 _showUserAgentStylesSettingChanged: function(event) | 944 _showUserAgentStylesSettingChanged: function(event) |
| 827 { | 945 { |
| 828 var showStyles = /** @type {boolean} */ (event.data); | 946 var showStyles = /** @type {boolean} */ (event.data); |
| 829 this.element.enableStyleClass("show-user-styles", showStyles); | 947 this.element.enableStyleClass("show-user-styles", showStyles); |
| 830 }, | 948 }, |
| 831 | 949 |
| 832 willHide: function() | 950 willHide: function() |
| 833 { | 951 { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 874 /** | 992 /** |
| 875 * @constructor | 993 * @constructor |
| 876 * @extends {WebInspector.SidebarPane} | 994 * @extends {WebInspector.SidebarPane} |
| 877 */ | 995 */ |
| 878 WebInspector.ComputedStyleSidebarPane = function() | 996 WebInspector.ComputedStyleSidebarPane = function() |
| 879 { | 997 { |
| 880 WebInspector.SidebarPane.call(this, WebInspector.UIString("Computed Style")) ; | 998 WebInspector.SidebarPane.call(this, WebInspector.UIString("Computed Style")) ; |
| 881 } | 999 } |
| 882 | 1000 |
| 883 WebInspector.ComputedStyleSidebarPane.prototype = { | 1001 WebInspector.ComputedStyleSidebarPane.prototype = { |
| 1002 /** | |
| 1003 * @param {!WebInspector.StylesSidebarPane} pane | |
| 1004 */ | |
| 1005 setHostingPane: function(pane) | |
| 1006 { | |
| 1007 this._stylesSidebarPane = pane; | |
| 1008 }, | |
| 1009 | |
| 1010 setFilterBoxContainer: function(element) | |
| 1011 { | |
| 1012 element.appendChild(this._stylesSidebarPane._createPropertyFilterElement (true, filterCallback.bind(this))); | |
|
pfeldman
2014/03/13 05:33:53
This is a strange API. Why does computed style pan
apavlov
2014/03/13 16:28:15
The key point here is that the filters are uniform
| |
| 1013 | |
| 1014 /** | |
| 1015 * @param {?RegExp} regex | |
| 1016 * @this {WebInspector.ComputedStyleSidebarPane} | |
| 1017 */ | |
| 1018 function filterCallback(regex) | |
| 1019 { | |
| 1020 this._filterRegex = regex; | |
| 1021 } | |
| 1022 }, | |
| 1023 | |
| 884 wasShown: function() | 1024 wasShown: function() |
| 885 { | 1025 { |
| 886 WebInspector.SidebarPane.prototype.wasShown.call(this); | 1026 WebInspector.SidebarPane.prototype.wasShown.call(this); |
| 887 if (!this._hasFreshContent) | 1027 if (!this._hasFreshContent) |
| 888 this.prepareContent(); | 1028 this.prepareContent(); |
| 889 }, | 1029 }, |
| 890 | 1030 |
| 891 /** | 1031 /** |
| 892 * @param {function()=} callback | 1032 * @param {function()=} callback |
| 893 */ | 1033 */ |
| 894 prepareContent: function(callback) | 1034 prepareContent: function(callback) |
| 895 { | 1035 { |
| 896 /** | 1036 /** |
| 897 * @this {WebInspector.ComputedStyleSidebarPane} | 1037 * @this {WebInspector.ComputedStyleSidebarPane} |
| 898 */ | 1038 */ |
| 899 function wrappedCallback() { | 1039 function wrappedCallback() { |
| 900 this._hasFreshContent = true; | 1040 this._hasFreshContent = true; |
| 901 if (callback) | 1041 if (callback) |
| 902 callback(); | 1042 callback(); |
| 903 delete this._hasFreshContent; | 1043 delete this._hasFreshContent; |
| 904 } | 1044 } |
| 905 this._stylesSidebarPane._refreshUpdate(null, true, wrappedCallback.bind( this)); | 1045 this._stylesSidebarPane._refreshUpdate(null, true, wrappedCallback.bind( this)); |
| 906 }, | 1046 }, |
| 907 | 1047 |
| 1048 /** | |
| 1049 * @return {?RegExp} | |
| 1050 */ | |
| 1051 filterRegex: function() | |
| 1052 { | |
| 1053 return this._filterRegex; | |
| 1054 }, | |
| 1055 | |
| 908 __proto__: WebInspector.SidebarPane.prototype | 1056 __proto__: WebInspector.SidebarPane.prototype |
| 909 } | 1057 } |
| 910 | 1058 |
| 911 /** | 1059 /** |
| 912 * @constructor | 1060 * @constructor |
| 913 * @extends {WebInspector.PropertiesSection} | 1061 * @extends {WebInspector.PropertiesSection} |
| 914 * @param {!WebInspector.StylesSidebarPane} parentPane | 1062 * @param {!WebInspector.StylesSidebarPane} parentPane |
| 915 * @param {!Object} styleRule | 1063 * @param {!Object} styleRule |
| 916 * @param {boolean} editable | 1064 * @param {boolean} editable |
| 917 * @param {boolean} isInherited | 1065 * @param {boolean} isInherited |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1215 if (shorthandPropertyAvailable) | 1363 if (shorthandPropertyAvailable) |
| 1216 continue; // Shorthand for the property found. | 1364 continue; // Shorthand for the property found. |
| 1217 | 1365 |
| 1218 var inherited = this.isPropertyInherited(property.name); | 1366 var inherited = this.isPropertyInherited(property.name); |
| 1219 var overloaded = property.inactive || this.isPropertyOverloaded(prop erty.name, isShorthand); | 1367 var overloaded = property.inactive || this.isPropertyOverloaded(prop erty.name, isShorthand); |
| 1220 var item = new WebInspector.StylePropertyTreeElement(this._parentPan e, this.styleRule, style, property, isShorthand, inherited, overloaded); | 1368 var item = new WebInspector.StylePropertyTreeElement(this._parentPan e, this.styleRule, style, property, isShorthand, inherited, overloaded); |
| 1221 this.propertiesTreeOutline.appendChild(item); | 1369 this.propertiesTreeOutline.appendChild(item); |
| 1222 } | 1370 } |
| 1223 }, | 1371 }, |
| 1224 | 1372 |
| 1373 updateFilter: function() | |
| 1374 { | |
| 1375 var children = this.propertiesTreeOutline.children; | |
| 1376 for (var i = 0; i < children.length; ++i) | |
| 1377 children[i].updateFilter(); | |
| 1378 | |
| 1379 if (this.styleRule.rule) | |
| 1380 this._markSelectorHighlights(); | |
| 1381 }, | |
| 1382 | |
| 1225 _markSelectorMatches: function() | 1383 _markSelectorMatches: function() |
| 1226 { | 1384 { |
| 1227 var rule = this.styleRule.rule; | 1385 var rule = this.styleRule.rule; |
| 1228 if (!rule) | 1386 if (!rule) |
| 1229 return; | 1387 return; |
| 1230 | 1388 |
| 1231 var matchingSelectors = rule.matchingSelectors; | 1389 var matchingSelectors = rule.matchingSelectors; |
| 1232 // .selector is rendered as non-affecting selector by default. | 1390 // .selector is rendered as non-affecting selector by default. |
| 1233 if (this.noAffect || matchingSelectors) | 1391 if (this.noAffect || matchingSelectors) |
| 1234 this._selectorElement.className = "selector"; | 1392 this._selectorElement.className = "selector"; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 1250 selectorElement.className = "simple-selector" + matchingSelectorClas s; | 1408 selectorElement.className = "simple-selector" + matchingSelectorClas s; |
| 1251 if (rule.id) | 1409 if (rule.id) |
| 1252 selectorElement._selectorIndex = i; | 1410 selectorElement._selectorIndex = i; |
| 1253 selectorElement.textContent = selectors[i].value; | 1411 selectorElement.textContent = selectors[i].value; |
| 1254 | 1412 |
| 1255 fragment.appendChild(selectorElement); | 1413 fragment.appendChild(selectorElement); |
| 1256 } | 1414 } |
| 1257 | 1415 |
| 1258 this._selectorElement.removeChildren(); | 1416 this._selectorElement.removeChildren(); |
| 1259 this._selectorElement.appendChild(fragment); | 1417 this._selectorElement.appendChild(fragment); |
| 1418 this._markSelectorHighlights(); | |
| 1419 }, | |
| 1420 | |
| 1421 _markSelectorHighlights: function() | |
| 1422 { | |
| 1423 var selectors = this._selectorElement.getElementsByClassName("simple-sel ector"); | |
| 1424 var regex = this.pane.filterRegex(); | |
| 1425 for (var i = 0; i < selectors.length; ++i) { | |
| 1426 var selectorMatchesFilter = regex && regex.test(selectors[i].textCon tent); | |
| 1427 selectors[i].enableStyleClass("filter-match", selectorMatchesFilter) ; | |
| 1428 } | |
| 1260 }, | 1429 }, |
| 1261 | 1430 |
| 1262 _checkWillCancelEditing: function() | 1431 _checkWillCancelEditing: function() |
| 1263 { | 1432 { |
| 1264 var willCauseCancelEditing = this._willCauseCancelEditing; | 1433 var willCauseCancelEditing = this._willCauseCancelEditing; |
| 1265 delete this._willCauseCancelEditing; | 1434 delete this._willCauseCancelEditing; |
| 1266 return willCauseCancelEditing; | 1435 return willCauseCancelEditing; |
| 1267 }, | 1436 }, |
| 1268 | 1437 |
| 1269 _handleSelectorContainerClick: function(event) | 1438 _handleSelectorContainerClick: function(event) |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1499 * @constructor | 1668 * @constructor |
| 1500 * @extends {WebInspector.PropertiesSection} | 1669 * @extends {WebInspector.PropertiesSection} |
| 1501 * @param {!WebInspector.StylesSidebarPane} stylesPane | 1670 * @param {!WebInspector.StylesSidebarPane} stylesPane |
| 1502 * @param {!Object} styleRule | 1671 * @param {!Object} styleRule |
| 1503 * @param {!Object.<string, boolean>} usedProperties | 1672 * @param {!Object.<string, boolean>} usedProperties |
| 1504 */ | 1673 */ |
| 1505 WebInspector.ComputedStylePropertiesSection = function(stylesPane, styleRule, us edProperties) | 1674 WebInspector.ComputedStylePropertiesSection = function(stylesPane, styleRule, us edProperties) |
| 1506 { | 1675 { |
| 1507 WebInspector.PropertiesSection.call(this, ""); | 1676 WebInspector.PropertiesSection.call(this, ""); |
| 1508 | 1677 |
| 1509 var showInheritedCheckbox = new WebInspector.Checkbox(WebInspector.UIString( "Show inherited properties"), "sidebar-pane-subtitle"); | 1678 var subtitle = this.headerElement.createChild("div", "sidebar-pane-subtitle vbox"); |
| 1510 this.headerElement.appendChild(showInheritedCheckbox.element); | 1679 var showInheritedCheckbox = new WebInspector.Checkbox(WebInspector.UIString( "Show inherited properties"), "hbox"); |
| 1680 subtitle.appendChild(showInheritedCheckbox.element); | |
| 1681 | |
| 1511 this._hasFreshContent = false; | 1682 this._hasFreshContent = false; |
| 1512 | 1683 |
| 1513 /** | 1684 /** |
| 1514 * @this {WebInspector.ComputedStylePropertiesSection} | 1685 * @this {WebInspector.ComputedStylePropertiesSection} |
| 1515 */ | 1686 */ |
| 1516 function showInheritedToggleFunction() | 1687 function showInheritedToggleFunction() |
| 1517 { | 1688 { |
| 1518 var showInherited = showInheritedCheckbox.checked; | 1689 var showInherited = showInheritedCheckbox.checked; |
| 1519 WebInspector.settings.showInheritedComputedStyleProperties.set(showInher ited); | 1690 WebInspector.settings.showInheritedComputedStyleProperties.set(showInher ited); |
| 1520 if (showInherited) | 1691 if (showInherited) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1557 this._expandedPropertyNames = {}; | 1728 this._expandedPropertyNames = {}; |
| 1558 for (var name in this._propertyTreeElements) { | 1729 for (var name in this._propertyTreeElements) { |
| 1559 if (this._propertyTreeElements[name].expanded) | 1730 if (this._propertyTreeElements[name].expanded) |
| 1560 this._expandedPropertyNames[name] = true; | 1731 this._expandedPropertyNames[name] = true; |
| 1561 } | 1732 } |
| 1562 this._propertyTreeElements = {}; | 1733 this._propertyTreeElements = {}; |
| 1563 this.propertiesTreeOutline.removeChildren(); | 1734 this.propertiesTreeOutline.removeChildren(); |
| 1564 this.populated = false; | 1735 this.populated = false; |
| 1565 }, | 1736 }, |
| 1566 | 1737 |
| 1738 updateFilter: function() | |
| 1739 { | |
| 1740 var children = this.propertiesTreeOutline.children; | |
| 1741 for (var i = 0; i < children.length; ++i) | |
| 1742 children[i].updateFilter(); | |
| 1743 }, | |
| 1744 | |
| 1567 onpopulate: function() | 1745 onpopulate: function() |
| 1568 { | 1746 { |
| 1569 function sorter(a, b) | 1747 function sorter(a, b) |
| 1570 { | 1748 { |
| 1571 return a.name.compareTo(b.name); | 1749 return a.name.compareTo(b.name); |
| 1572 } | 1750 } |
| 1573 | 1751 |
| 1574 var style = this.styleRule.style; | 1752 var style = this.styleRule.style; |
| 1575 if (!style) | 1753 if (!style) |
| 1576 return; | 1754 return; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1760 }, | 1938 }, |
| 1761 | 1939 |
| 1762 /** | 1940 /** |
| 1763 * @return {?WebInspector.StylesSidebarPane} | 1941 * @return {?WebInspector.StylesSidebarPane} |
| 1764 */ | 1942 */ |
| 1765 editablePane: function() | 1943 editablePane: function() |
| 1766 { | 1944 { |
| 1767 return null; // Overridden by ancestors. | 1945 return null; // Overridden by ancestors. |
| 1768 }, | 1946 }, |
| 1769 | 1947 |
| 1948 /** | |
| 1949 * @return {!WebInspector.StylesSidebarPane|!WebInspector.ComputedStyleSideb arPane} | |
| 1950 */ | |
| 1951 parentPane: function() | |
| 1952 { | |
| 1953 throw "Not implemented"; | |
| 1954 }, | |
| 1955 | |
| 1770 get inherited() | 1956 get inherited() |
| 1771 { | 1957 { |
| 1772 return this._inherited; | 1958 return this._inherited; |
| 1773 }, | 1959 }, |
| 1774 | 1960 |
| 1775 /** | 1961 /** |
| 1776 * @return {boolean} | 1962 * @return {boolean} |
| 1777 */ | 1963 */ |
| 1778 hasIgnorableError: function() | 1964 hasIgnorableError: function() |
| 1779 { | 1965 { |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1949 if (!this.parsedOk) { | 2135 if (!this.parsedOk) { |
| 1950 // Avoid having longhands under an invalid shorthand. | 2136 // Avoid having longhands under an invalid shorthand. |
| 1951 this.hasChildren = false; | 2137 this.hasChildren = false; |
| 1952 this.listItemElement.classList.add("not-parsed-ok"); | 2138 this.listItemElement.classList.add("not-parsed-ok"); |
| 1953 | 2139 |
| 1954 // Add a separate exclamation mark IMG element with a tooltip. | 2140 // Add a separate exclamation mark IMG element with a tooltip. |
| 1955 this.listItemElement.insertBefore(WebInspector.StylesSidebarPane.cre ateExclamationMark(this.property), this.listItemElement.firstChild); | 2141 this.listItemElement.insertBefore(WebInspector.StylesSidebarPane.cre ateExclamationMark(this.property), this.listItemElement.firstChild); |
| 1956 } | 2142 } |
| 1957 if (this.property.inactive) | 2143 if (this.property.inactive) |
| 1958 this.listItemElement.classList.add("inactive"); | 2144 this.listItemElement.classList.add("inactive"); |
| 2145 this.updateFilter(); | |
| 2146 }, | |
| 2147 | |
| 2148 updateFilter: function() | |
| 2149 { | |
| 2150 var regEx = this.parentPane().filterRegex(); | |
| 2151 this.listItemElement.enableStyleClass("filter-match", !!regEx && (regEx. test(this.property.name) || regEx.test(this.property.value))); | |
| 1959 }, | 2152 }, |
| 1960 | 2153 |
| 1961 /** | 2154 /** |
| 1962 * @param {!Element} nameElement | 2155 * @param {!Element} nameElement |
| 1963 * @param {!Element} valueElement | 2156 * @param {!Element} valueElement |
| 1964 * @param {string} text | 2157 * @param {string} text |
| 1965 */ | 2158 */ |
| 1966 _processColor: function(nameElement, valueElement, text) | 2159 _processColor: function(nameElement, valueElement, text) |
| 1967 { | 2160 { |
| 1968 var color = WebInspector.Color.parse(text); | 2161 var color = WebInspector.Color.parse(text); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2180 }, | 2373 }, |
| 2181 | 2374 |
| 2182 /** | 2375 /** |
| 2183 * @return {?WebInspector.StylesSidebarPane} | 2376 * @return {?WebInspector.StylesSidebarPane} |
| 2184 */ | 2377 */ |
| 2185 editablePane: function() | 2378 editablePane: function() |
| 2186 { | 2379 { |
| 2187 return null; | 2380 return null; |
| 2188 }, | 2381 }, |
| 2189 | 2382 |
| 2383 /** | |
| 2384 * @return {!WebInspector.ComputedStyleSidebarPane} | |
| 2385 */ | |
| 2386 parentPane: function() | |
| 2387 { | |
| 2388 return this._stylesPane._computedStylePane; | |
| 2389 }, | |
| 2390 | |
| 2391 updateFilter: function() | |
| 2392 { | |
| 2393 var regEx = this.parentPane().filterRegex(); | |
| 2394 this.listItemElement.enableStyleClass("hidden", !!regEx && (!regEx.test( this.property.name) && !regEx.test(this.property.value))); | |
| 2395 }, | |
| 2396 | |
| 2190 __proto__: WebInspector.StylePropertyTreeElementBase.prototype | 2397 __proto__: WebInspector.StylePropertyTreeElementBase.prototype |
| 2191 } | 2398 } |
| 2192 | 2399 |
| 2193 /** | 2400 /** |
| 2194 * @constructor | 2401 * @constructor |
| 2195 * @extends {WebInspector.StylePropertyTreeElementBase} | 2402 * @extends {WebInspector.StylePropertyTreeElementBase} |
| 2196 * @param {!WebInspector.StylesSidebarPane} stylesPane | 2403 * @param {!WebInspector.StylesSidebarPane} stylesPane |
| 2197 * @param {!Object} styleRule | 2404 * @param {!Object} styleRule |
| 2198 * @param {!WebInspector.CSSStyleDeclaration} style | 2405 * @param {!WebInspector.CSSStyleDeclaration} style |
| 2199 * @param {!WebInspector.CSSProperty} property | 2406 * @param {!WebInspector.CSSProperty} property |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 2219 | 2426 |
| 2220 /** | 2427 /** |
| 2221 * @return {?WebInspector.StylesSidebarPane} | 2428 * @return {?WebInspector.StylesSidebarPane} |
| 2222 */ | 2429 */ |
| 2223 editablePane: function() | 2430 editablePane: function() |
| 2224 { | 2431 { |
| 2225 return this._parentPane; | 2432 return this._parentPane; |
| 2226 }, | 2433 }, |
| 2227 | 2434 |
| 2228 /** | 2435 /** |
| 2436 * @return {!WebInspector.StylesSidebarPane} | |
| 2437 */ | |
| 2438 parentPane: function() | |
| 2439 { | |
| 2440 return this._parentPane; | |
| 2441 }, | |
| 2442 | |
| 2443 /** | |
| 2229 * @return {?WebInspector.StylePropertiesSection} | 2444 * @return {?WebInspector.StylePropertiesSection} |
| 2230 */ | 2445 */ |
| 2231 section: function() | 2446 section: function() |
| 2232 { | 2447 { |
| 2233 return this.treeOutline && this.treeOutline.section; | 2448 return this.treeOutline && this.treeOutline.section; |
| 2234 }, | 2449 }, |
| 2235 | 2450 |
| 2236 /** | 2451 /** |
| 2237 * @param {function()=} userCallback | 2452 * @param {function()=} userCallback |
| 2238 */ | 2453 */ |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3019 return; | 3234 return; |
| 3020 } | 3235 } |
| 3021 | 3236 |
| 3022 var results = this._cssCompletions.startsWith(prefix); | 3237 var results = this._cssCompletions.startsWith(prefix); |
| 3023 var selectedIndex = this._cssCompletions.mostUsedOf(results); | 3238 var selectedIndex = this._cssCompletions.mostUsedOf(results); |
| 3024 completionsReadyCallback(results, selectedIndex); | 3239 completionsReadyCallback(results, selectedIndex); |
| 3025 }, | 3240 }, |
| 3026 | 3241 |
| 3027 __proto__: WebInspector.TextPrompt.prototype | 3242 __proto__: WebInspector.TextPrompt.prototype |
| 3028 } | 3243 } |
| OLD | NEW |