| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.Widget} | 7 * @extends {WebInspector.Widget} |
| 8 */ | 8 */ |
| 9 WebInspector.ElementStatePaneWidget = function() | 9 WebInspector.ElementStatePaneWidget = function() |
| 10 { | 10 { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 var tr = table.createChild("tr"); | 46 var tr = table.createChild("tr"); |
| 47 tr.appendChild(createCheckbox.call(null, "active")); | 47 tr.appendChild(createCheckbox.call(null, "active")); |
| 48 tr.appendChild(createCheckbox.call(null, "hover")); | 48 tr.appendChild(createCheckbox.call(null, "hover")); |
| 49 | 49 |
| 50 tr = table.createChild("tr"); | 50 tr = table.createChild("tr"); |
| 51 tr.appendChild(createCheckbox.call(null, "focus")); | 51 tr.appendChild(createCheckbox.call(null, "focus")); |
| 52 tr.appendChild(createCheckbox.call(null, "visited")); | 52 tr.appendChild(createCheckbox.call(null, "visited")); |
| 53 | 53 |
| 54 this.element.appendChild(table); | 54 this.element.appendChild(table); |
| 55 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._upd
ate, this); | 55 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._upd
ate, this); |
| 56 } | 56 }; |
| 57 | 57 |
| 58 WebInspector.ElementStatePaneWidget.prototype = { | 58 WebInspector.ElementStatePaneWidget.prototype = { |
| 59 /** | 59 /** |
| 60 * @param {?WebInspector.Target} target | 60 * @param {?WebInspector.Target} target |
| 61 */ | 61 */ |
| 62 _updateTarget: function(target) | 62 _updateTarget: function(target) |
| 63 { | 63 { |
| 64 if (this._target === target) | 64 if (this._target === target) |
| 65 return; | 65 return; |
| 66 | 66 |
| 67 if (this._target) { | 67 if (this._target) { |
| 68 var cssModel = WebInspector.CSSModel.fromTarget(this._target); | 68 var cssModel = WebInspector.CSSModel.fromTarget(this._target); |
| 69 cssModel.removeEventListener(WebInspector.CSSModel.Events.PseudoStat
eForced, this._update, this) | 69 cssModel.removeEventListener(WebInspector.CSSModel.Events.PseudoStat
eForced, this._update, this); |
| 70 } | 70 } |
| 71 this._target = target; | 71 this._target = target; |
| 72 if (target) { | 72 if (target) { |
| 73 var cssModel = WebInspector.CSSModel.fromTarget(target); | 73 var cssModel = WebInspector.CSSModel.fromTarget(target); |
| 74 cssModel.addEventListener(WebInspector.CSSModel.Events.PseudoStateFo
rced, this._update, this) | 74 cssModel.addEventListener(WebInspector.CSSModel.Events.PseudoStateFo
rced, this._update, this); |
| 75 } | 75 } |
| 76 }, | 76 }, |
| 77 | 77 |
| 78 /** | 78 /** |
| 79 * @override | 79 * @override |
| 80 */ | 80 */ |
| 81 wasShown: function() | 81 wasShown: function() |
| 82 { | 82 { |
| 83 this._update(); | 83 this._update(); |
| 84 }, | 84 }, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 101 } | 101 } |
| 102 } else { | 102 } else { |
| 103 for (var input of this._inputs) { | 103 for (var input of this._inputs) { |
| 104 input.disabled = true; | 104 input.disabled = true; |
| 105 input.checked = false; | 105 input.checked = false; |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 }, | 108 }, |
| 109 | 109 |
| 110 __proto__: WebInspector.Widget.prototype | 110 __proto__: WebInspector.Widget.prototype |
| 111 } | 111 }; |
| 112 | 112 |
| 113 /** | 113 /** |
| 114 * @constructor | 114 * @constructor |
| 115 * @implements {WebInspector.ToolbarItem.Provider} | 115 * @implements {WebInspector.ToolbarItem.Provider} |
| 116 */ | 116 */ |
| 117 WebInspector.ElementStatePaneWidget.ButtonProvider = function() | 117 WebInspector.ElementStatePaneWidget.ButtonProvider = function() |
| 118 { | 118 { |
| 119 this._button = new WebInspector.ToolbarToggle(WebInspector.UIString("Toggle
Element State"), "", WebInspector.UIString(":hov")); | 119 this._button = new WebInspector.ToolbarToggle(WebInspector.UIString("Toggle
Element State"), "", WebInspector.UIString(":hov")); |
| 120 this._button.addEventListener("click", this._clicked, this); | 120 this._button.addEventListener("click", this._clicked, this); |
| 121 this._button.element.classList.add("monospace"); | 121 this._button.element.classList.add("monospace"); |
| 122 this._view = new WebInspector.ElementStatePaneWidget(); | 122 this._view = new WebInspector.ElementStatePaneWidget(); |
| 123 } | 123 }; |
| 124 | 124 |
| 125 WebInspector.ElementStatePaneWidget.ButtonProvider.prototype = { | 125 WebInspector.ElementStatePaneWidget.ButtonProvider.prototype = { |
| 126 _clicked: function() | 126 _clicked: function() |
| 127 { | 127 { |
| 128 WebInspector.ElementsPanel.instance().showToolbarPane(!this._view.isShow
ing() ? this._view : null, this._button); | 128 WebInspector.ElementsPanel.instance().showToolbarPane(!this._view.isShow
ing() ? this._view : null, this._button); |
| 129 }, | 129 }, |
| 130 | 130 |
| 131 /** | 131 /** |
| 132 * @override | 132 * @override |
| 133 * @return {!WebInspector.ToolbarItem} | 133 * @return {!WebInspector.ToolbarItem} |
| 134 */ | 134 */ |
| 135 item: function() | 135 item: function() |
| 136 { | 136 { |
| 137 return this._button; | 137 return this._button; |
| 138 } | 138 } |
| 139 } | 139 }; |
| OLD | NEW |