Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: Source/devtools/front_end/StylesSidebarPane.js

Issue 129793013: DevTools: Implement Styles search and Computed style filter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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)
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 firstSection._moveEditorFromSelector(event.shiftKey ? "backward" : " forward");
225 }
226 return filterInput;
227 },
228
183 get _forcedPseudoClasses() 229 get _forcedPseudoClasses()
184 { 230 {
185 return this.node ? (this.node.getUserProperty("pseudoState") || undefine d) : undefined; 231 return this.node ? (this.node.getUserProperty("pseudoState") || undefine d) : undefined;
186 }, 232 },
187 233
188 _updateForcedPseudoStateInputs: function() 234 _updateForcedPseudoStateInputs: function()
189 { 235 {
190 if (!this.node) 236 if (!this.node)
191 return; 237 return;
192 238
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 this._rebuildUpdate(); 285 this._rebuildUpdate();
240 }, 286 },
241 287
242 /** 288 /**
243 * @param {!WebInspector.StylePropertiesSection=} editedSection 289 * @param {!WebInspector.StylePropertiesSection=} editedSection
244 * @param {boolean=} forceFetchComputedStyle 290 * @param {boolean=} forceFetchComputedStyle
245 * @param {function()=} userCallback 291 * @param {function()=} userCallback
246 */ 292 */
247 _refreshUpdate: function(editedSection, forceFetchComputedStyle, userCallbac k) 293 _refreshUpdate: function(editedSection, forceFetchComputedStyle, userCallbac k)
248 { 294 {
295 var callbackWrapper = function()
296 {
297 if (this._filterRegex)
298 this._updateFilter(false);
299 if (userCallback)
300 userCallback();
301 }.bind(this);
302
249 if (this._refreshUpdateInProgress) { 303 if (this._refreshUpdateInProgress) {
250 this._lastNodeForInnerRefresh = this.node; 304 this._lastNodeForInnerRefresh = this.node;
251 return; 305 return;
252 } 306 }
253 307
254 var node = this._validateNode(userCallback); 308 var node = this._validateNode(userCallback);
255 if (!node) 309 if (!node)
256 return; 310 return;
257 311
258 /** 312 /**
259 * @param {?WebInspector.CSSStyleDeclaration} computedStyle 313 * @param {?WebInspector.CSSStyleDeclaration} computedStyle
260 * @this {WebInspector.StylesSidebarPane} 314 * @this {WebInspector.StylesSidebarPane}
261 */ 315 */
262 function computedStyleCallback(computedStyle) 316 function computedStyleCallback(computedStyle)
263 { 317 {
264 delete this._refreshUpdateInProgress; 318 delete this._refreshUpdateInProgress;
265 319
266 if (this._lastNodeForInnerRefresh) { 320 if (this._lastNodeForInnerRefresh) {
267 delete this._lastNodeForInnerRefresh; 321 delete this._lastNodeForInnerRefresh;
268 this._refreshUpdate(editedSection, forceFetchComputedStyle, user Callback); 322 this._refreshUpdate(editedSection, forceFetchComputedStyle, call backWrapper);
269 return; 323 return;
270 } 324 }
271 325
272 if (this.node === node && computedStyle) 326 if (this.node === node && computedStyle)
273 this._innerRefreshUpdate(node, computedStyle, editedSection); 327 this._innerRefreshUpdate(node, computedStyle, editedSection);
274 328
275 if (userCallback) 329 callbackWrapper();
276 userCallback();
277 } 330 }
278 331
279 if (this._computedStylePane.isShowing() || forceFetchComputedStyle) { 332 if (this._computedStylePane.isShowing() || forceFetchComputedStyle) {
280 this._refreshUpdateInProgress = true; 333 this._refreshUpdateInProgress = true;
281 WebInspector.cssModel.getComputedStyleAsync(node.id, computedStyleCa llback.bind(this)); 334 WebInspector.cssModel.getComputedStyleAsync(node.id, computedStyleCa llback.bind(this));
282 } else { 335 } else {
283 this._innerRefreshUpdate(node, null, editedSection); 336 this._innerRefreshUpdate(node, null, editedSection);
284 if (userCallback) 337 callbackWrapper();
285 userCallback();
286 } 338 }
287 }, 339 },
288 340
289 _rebuildUpdate: function() 341 _rebuildUpdate: function()
290 { 342 {
291 if (this._rebuildUpdateInProgress) { 343 if (this._rebuildUpdateInProgress) {
292 this._lastNodeForInnerRebuild = this.node; 344 this._lastNodeForInnerRebuild = this.node;
293 return; 345 return;
294 } 346 }
295 347
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 // Add rules in reverse order to match the cascade order. 508 // Add rules in reverse order to match the cascade order.
457 for (var j = pseudoElementCSSRules.rules.length - 1; j >= 0; --j) { 509 for (var j = pseudoElementCSSRules.rules.length - 1; j >= 0; --j) {
458 var rule = pseudoElementCSSRules.rules[j]; 510 var rule = pseudoElementCSSRules.rules[j];
459 styleRules.push({ style: rule.style, selectorText: rule.selector Text, media: rule.media, sourceURL: rule.resourceURL(), rule: rule, editable: !! (rule.style && rule.style.id) }); 511 styleRules.push({ style: rule.style, selectorText: rule.selector Text, media: rule.media, sourceURL: rule.resourceURL(), rule: rule, editable: !! (rule.style && rule.style.id) });
460 } 512 }
461 usedProperties = {}; 513 usedProperties = {};
462 this._markUsedProperties(styleRules, usedProperties); 514 this._markUsedProperties(styleRules, usedProperties);
463 this.sections[pseudoId] = this._rebuildSectionsForStyleRules(styleRu les, usedProperties, anchorElement); 515 this.sections[pseudoId] = this._rebuildSectionsForStyleRules(styleRu les, usedProperties, anchorElement);
464 } 516 }
465 517
518 if (this._filterRegex)
519 this._updateFilter(false);
466 this._nodeStylesUpdatedForTest(node, true); 520 this._nodeStylesUpdatedForTest(node, true);
467 }, 521 },
468 522
469 _nodeStylesUpdatedForTest: function(node, rebuild) 523 _nodeStylesUpdatedForTest: function(node, rebuild)
470 { 524 {
471 // Tests override this method. 525 // Tests override this method.
472 }, 526 },
473 527
474 _refreshStyleRules: function(sections, computedStyle) 528 _refreshStyleRules: function(sections, computedStyle)
475 { 529 {
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 input.type = "checkbox"; 853 input.type = "checkbox";
800 input.state = state; 854 input.state = state;
801 input.addEventListener("click", clickListener.bind(this), false); 855 input.addEventListener("click", clickListener.bind(this), false);
802 inputs.push(input); 856 inputs.push(input);
803 label.appendChild(input); 857 label.appendChild(input);
804 label.appendChild(document.createTextNode(":" + state)); 858 label.appendChild(document.createTextNode(":" + state));
805 td.appendChild(label); 859 td.appendChild(label);
806 return td; 860 return td;
807 } 861 }
808 862
809 var tr = document.createElement("tr"); 863 var tr = table.createChild("tr");
810 tr.appendChild(createCheckbox.call(this, "active")); 864 tr.appendChild(createCheckbox.call(this, "active"));
811 tr.appendChild(createCheckbox.call(this, "hover")); 865 tr.appendChild(createCheckbox.call(this, "hover"));
812 table.appendChild(tr);
813 866
814 tr = document.createElement("tr"); 867 tr = table.createChild("tr");
815 tr.appendChild(createCheckbox.call(this, "focus")); 868 tr.appendChild(createCheckbox.call(this, "focus"));
816 tr.appendChild(createCheckbox.call(this, "visited")); 869 tr.appendChild(createCheckbox.call(this, "visited"));
817 table.appendChild(tr);
818 870
819 this._elementStatePane.appendChild(table); 871 this._elementStatePane.appendChild(table);
820 }, 872 },
821 873
822 /** 874 /**
875 * @return {?RegExp}
876 */
877 filterRegex: function()
878 {
879 return this._filterRegex;
880 },
881
882 /**
883 * @param {boolean} isComputedStyleFilter
884 * @return {!Element}
885 * @param {function(?RegExp)} filterCallback
886 */
887 _createPropertyFilterElement: function(isComputedStyleFilter, filterCallback )
888 {
889 var input = document.createElement("input");
890 input.type = "text";
891 input.placeholder = isComputedStyleFilter ? WebInspector.UIString("Filte r") : WebInspector.UIString("Find in Styles");
892 input.className = "filter-box toolbar-search-control search-replace";
893 var boundSearchHandler = searchHandler.bind(this);
894
895 /**
896 * @this {WebInspector.StylesSidebarPane}
897 */
898 function searchHandler()
899 {
900 var regex = input.value ? new RegExp(input.value.escapeForRegExp(), "i") : null;
901 filterCallback(regex);
902 this._updateFilter(isComputedStyleFilter);
903 }
904 input.addEventListener("input", boundSearchHandler, false);
905
906 /**
907 * @param {?Event} event
908 */
909 function keydownHandler(event)
910 {
911 var Esc = "U+001B";
912 if (event.keyIdentifier !== Esc || !input.value)
913 return;
914 event.consume(true);
915 input.value = "";
916 boundSearchHandler();
917 }
918 input.addEventListener("keydown", keydownHandler, false);
919
920 return input;
921 },
922
923 /**
924 * @param {boolean} isComputedStyleFilter
925 */
926 _updateFilter: function(isComputedStyleFilter)
927 {
928 for (var pseudoId in this.sections) {
929 var sections = this.sections[pseudoId];
930 for (var i = 0; i < sections.length; ++i) {
931 var section = sections[i];
932 if (isComputedStyleFilter !== !!section.computedStyle)
933 continue;
934 section.updateFilter();
935 }
936 }
937 },
938
939 /**
823 * @param {!WebInspector.Event} event 940 * @param {!WebInspector.Event} event
824 */ 941 */
825 _showUserAgentStylesSettingChanged: function(event) 942 _showUserAgentStylesSettingChanged: function(event)
826 { 943 {
827 var showStyles = /** @type {boolean} */ (event.data); 944 var showStyles = /** @type {boolean} */ (event.data);
828 this.element.classList.toggle("show-user-styles", showStyles); 945 this.element.classList.toggle("show-user-styles", showStyles);
829 }, 946 },
830 947
831 willHide: function() 948 willHide: function()
832 { 949 {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 /** 990 /**
874 * @constructor 991 * @constructor
875 * @extends {WebInspector.SidebarPane} 992 * @extends {WebInspector.SidebarPane}
876 */ 993 */
877 WebInspector.ComputedStyleSidebarPane = function() 994 WebInspector.ComputedStyleSidebarPane = function()
878 { 995 {
879 WebInspector.SidebarPane.call(this, WebInspector.UIString("Computed Style")) ; 996 WebInspector.SidebarPane.call(this, WebInspector.UIString("Computed Style")) ;
880 } 997 }
881 998
882 WebInspector.ComputedStyleSidebarPane.prototype = { 999 WebInspector.ComputedStyleSidebarPane.prototype = {
1000 /**
1001 * @param {!WebInspector.StylesSidebarPane} pane
1002 */
1003 setHostingPane: function(pane)
1004 {
1005 this._stylesSidebarPane = pane;
1006 },
1007
1008 setFilterBoxContainer: function(element)
1009 {
1010 element.appendChild(this._stylesSidebarPane._createPropertyFilterElement (true, filterCallback.bind(this)));
1011
1012 /**
1013 * @param {?RegExp} regex
1014 * @this {WebInspector.ComputedStyleSidebarPane}
1015 */
1016 function filterCallback(regex)
1017 {
1018 this._filterRegex = regex;
1019 }
1020 },
1021
883 wasShown: function() 1022 wasShown: function()
884 { 1023 {
885 WebInspector.SidebarPane.prototype.wasShown.call(this); 1024 WebInspector.SidebarPane.prototype.wasShown.call(this);
886 if (!this._hasFreshContent) 1025 if (!this._hasFreshContent)
887 this.prepareContent(); 1026 this.prepareContent();
888 }, 1027 },
889 1028
890 /** 1029 /**
891 * @param {function()=} callback 1030 * @param {function()=} callback
892 */ 1031 */
893 prepareContent: function(callback) 1032 prepareContent: function(callback)
894 { 1033 {
895 /** 1034 /**
896 * @this {WebInspector.ComputedStyleSidebarPane} 1035 * @this {WebInspector.ComputedStyleSidebarPane}
897 */ 1036 */
898 function wrappedCallback() { 1037 function wrappedCallback() {
899 this._hasFreshContent = true; 1038 this._hasFreshContent = true;
900 if (callback) 1039 if (callback)
901 callback(); 1040 callback();
902 delete this._hasFreshContent; 1041 delete this._hasFreshContent;
903 } 1042 }
904 this._stylesSidebarPane._refreshUpdate(null, true, wrappedCallback.bind( this)); 1043 this._stylesSidebarPane._refreshUpdate(null, true, wrappedCallback.bind( this));
905 }, 1044 },
906 1045
1046 /**
1047 * @return {?RegExp}
1048 */
1049 filterRegex: function()
1050 {
1051 return this._filterRegex;
1052 },
1053
907 __proto__: WebInspector.SidebarPane.prototype 1054 __proto__: WebInspector.SidebarPane.prototype
908 } 1055 }
909 1056
910 /** 1057 /**
911 * @constructor 1058 * @constructor
912 * @extends {WebInspector.PropertiesSection} 1059 * @extends {WebInspector.PropertiesSection}
913 * @param {!WebInspector.StylesSidebarPane} parentPane 1060 * @param {!WebInspector.StylesSidebarPane} parentPane
914 * @param {!Object} styleRule 1061 * @param {!Object} styleRule
915 * @param {boolean} editable 1062 * @param {boolean} editable
916 * @param {boolean} isInherited 1063 * @param {boolean} isInherited
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 if (shorthandPropertyAvailable) 1361 if (shorthandPropertyAvailable)
1215 continue; // Shorthand for the property found. 1362 continue; // Shorthand for the property found.
1216 1363
1217 var inherited = this.isPropertyInherited(property.name); 1364 var inherited = this.isPropertyInherited(property.name);
1218 var overloaded = property.inactive || this.isPropertyOverloaded(prop erty.name, isShorthand); 1365 var overloaded = property.inactive || this.isPropertyOverloaded(prop erty.name, isShorthand);
1219 var item = new WebInspector.StylePropertyTreeElement(this._parentPan e, this.styleRule, style, property, isShorthand, inherited, overloaded); 1366 var item = new WebInspector.StylePropertyTreeElement(this._parentPan e, this.styleRule, style, property, isShorthand, inherited, overloaded);
1220 this.propertiesTreeOutline.appendChild(item); 1367 this.propertiesTreeOutline.appendChild(item);
1221 } 1368 }
1222 }, 1369 },
1223 1370
1371 updateFilter: function()
1372 {
1373 var children = this.propertiesTreeOutline.children;
1374 for (var i = 0; i < children.length; ++i)
1375 children[i].updateFilter();
1376
1377 if (this.styleRule.rule)
1378 this._markSelectorHighlights();
1379 },
1380
1224 _markSelectorMatches: function() 1381 _markSelectorMatches: function()
1225 { 1382 {
1226 var rule = this.styleRule.rule; 1383 var rule = this.styleRule.rule;
1227 if (!rule) 1384 if (!rule)
1228 return; 1385 return;
1229 1386
1230 var matchingSelectors = rule.matchingSelectors; 1387 var matchingSelectors = rule.matchingSelectors;
1231 // .selector is rendered as non-affecting selector by default. 1388 // .selector is rendered as non-affecting selector by default.
1232 if (this.noAffect || matchingSelectors) 1389 if (this.noAffect || matchingSelectors)
1233 this._selectorElement.className = "selector"; 1390 this._selectorElement.className = "selector";
(...skipping 15 matching lines...) Expand all
1249 selectorElement.className = "simple-selector" + matchingSelectorClas s; 1406 selectorElement.className = "simple-selector" + matchingSelectorClas s;
1250 if (rule.id) 1407 if (rule.id)
1251 selectorElement._selectorIndex = i; 1408 selectorElement._selectorIndex = i;
1252 selectorElement.textContent = selectors[i].value; 1409 selectorElement.textContent = selectors[i].value;
1253 1410
1254 fragment.appendChild(selectorElement); 1411 fragment.appendChild(selectorElement);
1255 } 1412 }
1256 1413
1257 this._selectorElement.removeChildren(); 1414 this._selectorElement.removeChildren();
1258 this._selectorElement.appendChild(fragment); 1415 this._selectorElement.appendChild(fragment);
1416 this._markSelectorHighlights();
1417 },
1418
1419 _markSelectorHighlights: function()
1420 {
1421 var selectors = this._selectorElement.getElementsByClassName("simple-sel ector");
1422 var regex = this.pane.filterRegex();
1423 for (var i = 0; i < selectors.length; ++i) {
1424 var selectorMatchesFilter = regex && regex.test(selectors[i].textCon tent);
1425 selectors[i].classList.toggle("filter-match", selectorMatchesFilter) ;
1426 }
1259 }, 1427 },
1260 1428
1261 _checkWillCancelEditing: function() 1429 _checkWillCancelEditing: function()
1262 { 1430 {
1263 var willCauseCancelEditing = this._willCauseCancelEditing; 1431 var willCauseCancelEditing = this._willCauseCancelEditing;
1264 delete this._willCauseCancelEditing; 1432 delete this._willCauseCancelEditing;
1265 return willCauseCancelEditing; 1433 return willCauseCancelEditing;
1266 }, 1434 },
1267 1435
1268 _handleSelectorContainerClick: function(event) 1436 _handleSelectorContainerClick: function(event)
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 * @constructor 1666 * @constructor
1499 * @extends {WebInspector.PropertiesSection} 1667 * @extends {WebInspector.PropertiesSection}
1500 * @param {!WebInspector.StylesSidebarPane} stylesPane 1668 * @param {!WebInspector.StylesSidebarPane} stylesPane
1501 * @param {!Object} styleRule 1669 * @param {!Object} styleRule
1502 * @param {!Object.<string, boolean>} usedProperties 1670 * @param {!Object.<string, boolean>} usedProperties
1503 */ 1671 */
1504 WebInspector.ComputedStylePropertiesSection = function(stylesPane, styleRule, us edProperties) 1672 WebInspector.ComputedStylePropertiesSection = function(stylesPane, styleRule, us edProperties)
1505 { 1673 {
1506 WebInspector.PropertiesSection.call(this, ""); 1674 WebInspector.PropertiesSection.call(this, "");
1507 1675
1508 var showInheritedCheckbox = new WebInspector.Checkbox(WebInspector.UIString( "Show inherited properties"), "sidebar-pane-subtitle"); 1676 var subtitle = this.headerElement.createChild("div", "sidebar-pane-subtitle vbox");
1509 this.headerElement.appendChild(showInheritedCheckbox.element); 1677 var showInheritedCheckbox = new WebInspector.Checkbox(WebInspector.UIString( "Show inherited properties"), "hbox");
1678 subtitle.appendChild(showInheritedCheckbox.element);
1679
1510 this._hasFreshContent = false; 1680 this._hasFreshContent = false;
1511 1681
1512 /** 1682 /**
1513 * @this {WebInspector.ComputedStylePropertiesSection} 1683 * @this {WebInspector.ComputedStylePropertiesSection}
1514 */ 1684 */
1515 function showInheritedToggleFunction() 1685 function showInheritedToggleFunction()
1516 { 1686 {
1517 var showInherited = showInheritedCheckbox.checked; 1687 var showInherited = showInheritedCheckbox.checked;
1518 WebInspector.settings.showInheritedComputedStyleProperties.set(showInher ited); 1688 WebInspector.settings.showInheritedComputedStyleProperties.set(showInher ited);
1519 if (showInherited) 1689 if (showInherited)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1556 this._expandedPropertyNames = {}; 1726 this._expandedPropertyNames = {};
1557 for (var name in this._propertyTreeElements) { 1727 for (var name in this._propertyTreeElements) {
1558 if (this._propertyTreeElements[name].expanded) 1728 if (this._propertyTreeElements[name].expanded)
1559 this._expandedPropertyNames[name] = true; 1729 this._expandedPropertyNames[name] = true;
1560 } 1730 }
1561 this._propertyTreeElements = {}; 1731 this._propertyTreeElements = {};
1562 this.propertiesTreeOutline.removeChildren(); 1732 this.propertiesTreeOutline.removeChildren();
1563 this.populated = false; 1733 this.populated = false;
1564 }, 1734 },
1565 1735
1736 updateFilter: function()
1737 {
1738 var children = this.propertiesTreeOutline.children;
1739 for (var i = 0; i < children.length; ++i)
1740 children[i].updateFilter();
1741 },
1742
1566 onpopulate: function() 1743 onpopulate: function()
1567 { 1744 {
1568 function sorter(a, b) 1745 function sorter(a, b)
1569 { 1746 {
1570 return a.name.compareTo(b.name); 1747 return a.name.compareTo(b.name);
1571 } 1748 }
1572 1749
1573 var style = this.styleRule.style; 1750 var style = this.styleRule.style;
1574 if (!style) 1751 if (!style)
1575 return; 1752 return;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1773 }, 1950 },
1774 1951
1775 /** 1952 /**
1776 * @return {?WebInspector.StylesSidebarPane} 1953 * @return {?WebInspector.StylesSidebarPane}
1777 */ 1954 */
1778 editablePane: function() 1955 editablePane: function()
1779 { 1956 {
1780 return null; // Overridden by ancestors. 1957 return null; // Overridden by ancestors.
1781 }, 1958 },
1782 1959
1960 /**
1961 * @return {!WebInspector.StylesSidebarPane|!WebInspector.ComputedStyleSideb arPane}
1962 */
1963 parentPane: function()
1964 {
1965 throw "Not implemented";
1966 },
1967
1783 get inherited() 1968 get inherited()
1784 { 1969 {
1785 return this._inherited; 1970 return this._inherited;
1786 }, 1971 },
1787 1972
1788 /** 1973 /**
1789 * @return {boolean} 1974 * @return {boolean}
1790 */ 1975 */
1791 hasIgnorableError: function() 1976 hasIgnorableError: function()
1792 { 1977 {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1955 if (!this.parsedOk) { 2140 if (!this.parsedOk) {
1956 // Avoid having longhands under an invalid shorthand. 2141 // Avoid having longhands under an invalid shorthand.
1957 this.hasChildren = false; 2142 this.hasChildren = false;
1958 this.listItemElement.classList.add("not-parsed-ok"); 2143 this.listItemElement.classList.add("not-parsed-ok");
1959 2144
1960 // Add a separate exclamation mark IMG element with a tooltip. 2145 // Add a separate exclamation mark IMG element with a tooltip.
1961 this.listItemElement.insertBefore(WebInspector.StylesSidebarPane.cre ateExclamationMark(this.property), this.listItemElement.firstChild); 2146 this.listItemElement.insertBefore(WebInspector.StylesSidebarPane.cre ateExclamationMark(this.property), this.listItemElement.firstChild);
1962 } 2147 }
1963 if (this.property.inactive) 2148 if (this.property.inactive)
1964 this.listItemElement.classList.add("inactive"); 2149 this.listItemElement.classList.add("inactive");
2150 this.updateFilter();
2151 },
2152
2153 updateFilter: function()
2154 {
2155 var regEx = this.parentPane().filterRegex();
2156 this.listItemElement.classList.toggle("filter-match", !!regEx && (regEx. test(this.property.name) || regEx.test(this.property.value)));
1965 }, 2157 },
1966 2158
1967 /** 2159 /**
1968 * @param {!Element} nameElement 2160 * @param {!Element} nameElement
1969 * @param {!Element} valueElement 2161 * @param {!Element} valueElement
1970 * @param {string} text 2162 * @param {string} text
1971 */ 2163 */
1972 _processColor: function(nameElement, valueElement, text) 2164 _processColor: function(nameElement, valueElement, text)
1973 { 2165 {
1974 var color = WebInspector.Color.parse(text); 2166 var color = WebInspector.Color.parse(text);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2186 }, 2378 },
2187 2379
2188 /** 2380 /**
2189 * @return {?WebInspector.StylesSidebarPane} 2381 * @return {?WebInspector.StylesSidebarPane}
2190 */ 2382 */
2191 editablePane: function() 2383 editablePane: function()
2192 { 2384 {
2193 return null; 2385 return null;
2194 }, 2386 },
2195 2387
2388 /**
2389 * @return {!WebInspector.ComputedStyleSidebarPane}
2390 */
2391 parentPane: function()
2392 {
2393 return this._stylesPane._computedStylePane;
2394 },
2395
2396 updateFilter: function()
2397 {
2398 var regEx = this.parentPane().filterRegex();
2399 this.listItemElement.classList.toggle("hidden", !!regEx && (!regEx.test( this.property.name) && !regEx.test(this.property.value)));
2400 },
2401
2196 __proto__: WebInspector.StylePropertyTreeElementBase.prototype 2402 __proto__: WebInspector.StylePropertyTreeElementBase.prototype
2197 } 2403 }
2198 2404
2199 /** 2405 /**
2200 * @constructor 2406 * @constructor
2201 * @extends {WebInspector.StylePropertyTreeElementBase} 2407 * @extends {WebInspector.StylePropertyTreeElementBase}
2202 * @param {!WebInspector.StylesSidebarPane} stylesPane 2408 * @param {!WebInspector.StylesSidebarPane} stylesPane
2203 * @param {!Object} styleRule 2409 * @param {!Object} styleRule
2204 * @param {!WebInspector.CSSStyleDeclaration} style 2410 * @param {!WebInspector.CSSStyleDeclaration} style
2205 * @param {!WebInspector.CSSProperty} property 2411 * @param {!WebInspector.CSSProperty} property
(...skipping 19 matching lines...) Expand all
2225 2431
2226 /** 2432 /**
2227 * @return {?WebInspector.StylesSidebarPane} 2433 * @return {?WebInspector.StylesSidebarPane}
2228 */ 2434 */
2229 editablePane: function() 2435 editablePane: function()
2230 { 2436 {
2231 return this._parentPane; 2437 return this._parentPane;
2232 }, 2438 },
2233 2439
2234 /** 2440 /**
2441 * @return {!WebInspector.StylesSidebarPane}
2442 */
2443 parentPane: function()
2444 {
2445 return this._parentPane;
2446 },
2447
2448 /**
2235 * @return {?WebInspector.StylePropertiesSection} 2449 * @return {?WebInspector.StylePropertiesSection}
2236 */ 2450 */
2237 section: function() 2451 section: function()
2238 { 2452 {
2239 return this.treeOutline && this.treeOutline.section; 2453 return this.treeOutline && this.treeOutline.section;
2240 }, 2454 },
2241 2455
2242 /** 2456 /**
2243 * @param {function()=} userCallback 2457 * @param {function()=} userCallback
2244 */ 2458 */
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after
3034 return; 3248 return;
3035 } 3249 }
3036 3250
3037 var results = this._cssCompletions.startsWith(prefix); 3251 var results = this._cssCompletions.startsWith(prefix);
3038 var selectedIndex = this._cssCompletions.mostUsedOf(results); 3252 var selectedIndex = this._cssCompletions.mostUsedOf(results);
3039 completionsReadyCallback(results, selectedIndex); 3253 completionsReadyCallback(results, selectedIndex);
3040 }, 3254 },
3041 3255
3042 __proto__: WebInspector.TextPrompt.prototype 3256 __proto__: WebInspector.TextPrompt.prototype
3043 } 3257 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698