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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 this.titleElement.appendChild(this.settingsSelectElement); | 64 this.titleElement.appendChild(this.settingsSelectElement); |
65 | 65 |
66 this._elementStateButton = document.createElement("button"); | 66 this._elementStateButton = document.createElement("button"); |
67 this._elementStateButton.className = "pane-title-button element-state"; | 67 this._elementStateButton.className = "pane-title-button element-state"; |
68 this._elementStateButton.title = WebInspector.UIString("Toggle Element State
"); | 68 this._elementStateButton.title = WebInspector.UIString("Toggle Element State
"); |
69 this._elementStateButton.addEventListener("click", this._toggleElementStateP
ane.bind(this), false); | 69 this._elementStateButton.addEventListener("click", this._toggleElementStateP
ane.bind(this), false); |
70 this.titleElement.appendChild(this._elementStateButton); | 70 this.titleElement.appendChild(this._elementStateButton); |
71 | 71 |
72 var addButton = document.createElement("button"); | 72 var addButton = document.createElement("button"); |
73 addButton.className = "pane-title-button add"; | 73 addButton.className = "pane-title-button add"; |
| 74 addButton.id = "add-style-button-test-id"; |
74 addButton.title = WebInspector.UIString("New Style Rule"); | 75 addButton.title = WebInspector.UIString("New Style Rule"); |
75 addButton.addEventListener("click", this._createNewRule.bind(this), false); | 76 addButton.addEventListener("click", this._createNewRule.bind(this), false); |
76 this.titleElement.appendChild(addButton); | 77 this.titleElement.appendChild(addButton); |
77 | 78 |
78 this._computedStylePane = computedStylePane; | 79 this._computedStylePane = computedStylePane; |
79 this.element.addEventListener("contextmenu", this._contextMenuEventFired.bin
d(this), true); | 80 this.element.addEventListener("contextmenu", this._contextMenuEventFired.bin
d(this), true); |
80 WebInspector.settings.colorFormat.addChangeListener(this._colorFormatSetting
Changed.bind(this)); | 81 WebInspector.settings.colorFormat.addChangeListener(this._colorFormatSetting
Changed.bind(this)); |
81 | 82 |
82 this._createElementStatePane(); | 83 this._createElementStatePane(); |
83 this.bodyElement.appendChild(this._elementStatePane); | 84 this.bodyElement.appendChild(this._elementStatePane); |
(...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1278 } | 1279 } |
1279 | 1280 |
1280 WebInspector.BlankStylePropertiesSection.prototype = { | 1281 WebInspector.BlankStylePropertiesSection.prototype = { |
1281 expand: function() | 1282 expand: function() |
1282 { | 1283 { |
1283 // Do nothing, blank sections are not expandable. | 1284 // Do nothing, blank sections are not expandable. |
1284 }, | 1285 }, |
1285 | 1286 |
1286 editingSelectorCommitted: function(element, newContent, oldContent, context) | 1287 editingSelectorCommitted: function(element, newContent, oldContent, context) |
1287 { | 1288 { |
1288 var self = this; | |
1289 function successCallback(newRule, doesSelectorAffectSelectedNode) | 1289 function successCallback(newRule, doesSelectorAffectSelectedNode) |
1290 { | 1290 { |
1291 var styleRule = { section: self, style: newRule.style, selectorText:
newRule.selectorText, sourceURL: newRule.sourceURL, rule: newRule }; | 1291 var styleRule = { section: this, style: newRule.style, selectorText:
newRule.selectorText, sourceURL: newRule.sourceURL, rule: newRule }; |
1292 self.makeNormal(styleRule); | 1292 this.makeNormal(styleRule); |
1293 | 1293 |
1294 if (!doesSelectorAffectSelectedNode) { | 1294 if (!doesSelectorAffectSelectedNode) { |
1295 self.noAffect = true; | 1295 this.noAffect = true; |
1296 self.element.addStyleClass("no-affect"); | 1296 this.element.addStyleClass("no-affect"); |
1297 } | 1297 } |
1298 | 1298 |
1299 self.subtitleElement.textContent = WebInspector.UIString("via inspec
tor"); | 1299 this.subtitleElement.textContent = WebInspector.UIString("via inspec
tor"); |
1300 self.expand(); | 1300 this.expand(); |
1301 | 1301 if (this.element.parentElement) // Might have been detached already
. |
1302 self.addNewBlankProperty().startEditing(); | 1302 this.addNewBlankProperty().startEditing(); |
1303 } | 1303 } |
1304 | 1304 |
1305 WebInspector.cssModel.addRule(this.pane.node.id, newContent, successCall
back, this.editingSelectorCancelled.bind(this)); | 1305 WebInspector.cssModel.addRule(this.pane.node.id, newContent, successCall
back.bind(this), this.editingSelectorCancelled.bind(this)); |
1306 }, | 1306 }, |
1307 | 1307 |
1308 editingSelectorCancelled: function() | 1308 editingSelectorCancelled: function() |
1309 { | 1309 { |
1310 this.pane.removeSection(this); | 1310 this.pane.removeSection(this); |
1311 }, | 1311 }, |
1312 | 1312 |
1313 makeNormal: function(styleRule) | 1313 makeNormal: function(styleRule) |
1314 { | 1314 { |
1315 this.element.removeStyleClass("blank-section"); | 1315 this.element.removeStyleClass("blank-section"); |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2200 return completionsReadyCallback(results); | 2200 return completionsReadyCallback(results); |
2201 } | 2201 } |
2202 | 2202 |
2203 results = this._cssCompletions.startsWith(prefix); | 2203 results = this._cssCompletions.startsWith(prefix); |
2204 if (results) | 2204 if (results) |
2205 completionsReadyCallback(results); | 2205 completionsReadyCallback(results); |
2206 } | 2206 } |
2207 } | 2207 } |
2208 | 2208 |
2209 WebInspector.StylesSidebarPane.CSSPropertyPrompt.prototype.__proto__ = WebInspec
tor.TextPrompt.prototype; | 2209 WebInspector.StylesSidebarPane.CSSPropertyPrompt.prototype.__proto__ = WebInspec
tor.TextPrompt.prototype; |
OLD | NEW |