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