| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
| 4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 this._dockSideChanged(); | 102 this._dockSideChanged(); |
| 103 this._loadSidebarViews(); | 103 this._loadSidebarViews(); |
| 104 | 104 |
| 105 /** @type {!Array.<!WebInspector.ElementsTreeOutline>} */ | 105 /** @type {!Array.<!WebInspector.ElementsTreeOutline>} */ |
| 106 this._treeOutlines = []; | 106 this._treeOutlines = []; |
| 107 /** @type {!Map.<!WebInspector.DOMModel, !WebInspector.ElementsTreeOutline>}
*/ | 107 /** @type {!Map.<!WebInspector.DOMModel, !WebInspector.ElementsTreeOutline>}
*/ |
| 108 this._modelToTreeOutline = new Map(); | 108 this._modelToTreeOutline = new Map(); |
| 109 WebInspector.targetManager.observeTargets(this); | 109 WebInspector.targetManager.observeTargets(this); |
| 110 WebInspector.moduleSetting("showUAShadowDOM").addChangeListener(this._showUA
ShadowDOMChanged.bind(this)); | 110 WebInspector.moduleSetting("showUAShadowDOM").addChangeListener(this._showUA
ShadowDOMChanged.bind(this)); |
| 111 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspec
tor.DOMModel.Events.DocumentUpdated, this._documentUpdatedEvent, this); | 111 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspec
tor.DOMModel.Events.DocumentUpdated, this._documentUpdatedEvent, this); |
| 112 WebInspector.targetManager.addModelListener(WebInspector.CSSStyleModel, WebI
nspector.CSSStyleModel.Events.PseudoStateForced, this._decoratorsChanged, this); | 112 if (Runtime.experiments.isEnabled("materialDesign")) |
| 113 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn
spector.DOMModel.Events.MarkersChanged, this._updateToolbarButtons, this); |
| 113 WebInspector.extensionServer.addEventListener(WebInspector.ExtensionServer.E
vents.SidebarPaneAdded, this._extensionSidebarPaneAdded, this); | 114 WebInspector.extensionServer.addEventListener(WebInspector.ExtensionServer.E
vents.SidebarPaneAdded, this._extensionSidebarPaneAdded, this); |
| 114 } | 115 } |
| 115 | 116 |
| 116 WebInspector.ElementsPanel._elementsSidebarViewTitleSymbol = Symbol("title"); | 117 WebInspector.ElementsPanel._elementsSidebarViewTitleSymbol = Symbol("title"); |
| 117 | 118 |
| 118 WebInspector.ElementsPanel.prototype = { | 119 WebInspector.ElementsPanel.prototype = { |
| 119 /** | 120 /** |
| 120 * @return {!WebInspector.Toolbar} | 121 * @return {!WebInspector.Toolbar} |
| 121 */ | 122 */ |
| 122 _createElementsToolbar: function() | 123 _createElementsToolbar: function() |
| (...skipping 21 matching lines...) Expand all Loading... |
| 144 return toolbar; | 145 return toolbar; |
| 145 }, | 146 }, |
| 146 | 147 |
| 147 _toggleHideElement: function() | 148 _toggleHideElement: function() |
| 148 { | 149 { |
| 149 var node = this.selectedDOMNode(); | 150 var node = this.selectedDOMNode(); |
| 150 var treeOutline = this._treeOutlineForNode(node); | 151 var treeOutline = this._treeOutlineForNode(node); |
| 151 if (!node || !treeOutline) | 152 if (!node || !treeOutline) |
| 152 return; | 153 return; |
| 153 treeOutline.toggleHideElement(node); | 154 treeOutline.toggleHideElement(node); |
| 154 this._hideElementButton.setToggled(!this._hideElementButton.toggled()); | |
| 155 }, | 155 }, |
| 156 | 156 |
| 157 _updateToolbarButtons: function() | 157 _updateToolbarButtons: function() |
| 158 { | 158 { |
| 159 if (!Runtime.experiments.isEnabled("materialDesign")) | 159 if (!Runtime.experiments.isEnabled("materialDesign")) |
| 160 return; | 160 return; |
| 161 var node = this.selectedDOMNode(); | 161 var node = this.selectedDOMNode(); |
| 162 if (!node) | 162 if (!node) |
| 163 return; | 163 return; |
| 164 var classText = node.getAttribute("class"); | 164 var classText = node.getAttribute("class"); |
| 165 this._hideElementButton.setToggled(classText && classText.match(/__web-i
nspector-hide/)); | 165 var treeOutline = this._treeOutlineForNode(node); |
| 166 this._hideElementButton.setToggled(treeOutline && treeOutline.isToggledT
oHidden(node)); |
| 166 this._editAsHTMLButton.setToggled(false); | 167 this._editAsHTMLButton.setToggled(false); |
| 167 this._breakpointsButton.setEnabled(!node.pseudoType()); | 168 this._breakpointsButton.setEnabled(!node.pseudoType()); |
| 169 this._breakpointsButton.setToggled(WebInspector.domBreakpointsSidebarPan
e.hasBreakpoints(node)); |
| 168 this._forceElementStateButton.setEnabled(node.nodeType() === Node.ELEMEN
T_NODE && !node.pseudoType()); | 170 this._forceElementStateButton.setEnabled(node.nodeType() === Node.ELEMEN
T_NODE && !node.pseudoType()); |
| 169 this._forceElementStateButton.setToggled(!!node.getUserProperty(WebInspe
ctor.CSSStyleModel.PseudoStatePropertyName)); | 171 this._forceElementStateButton.setToggled(!!WebInspector.CSSStyleModel.fr
omNode(node).pseudoState(node).length); |
| 170 }, | 172 }, |
| 171 | 173 |
| 172 _toggleEditAsHTML: function() | 174 _toggleEditAsHTML: function() |
| 173 { | 175 { |
| 174 var node = this.selectedDOMNode(); | 176 var node = this.selectedDOMNode(); |
| 175 var treeOutline = this._treeOutlineForNode(node); | 177 var treeOutline = this._treeOutlineForNode(node); |
| 176 if (!node || !treeOutline) | 178 if (!node || !treeOutline) |
| 177 return; | 179 return; |
| 178 var startEditing = !this._editAsHTMLButton.toggled(); | 180 var startEditing = !this._editAsHTMLButton.toggled(); |
| 179 treeOutline.toggleEditAsHTML(node, startEditing, this._updateToolbarButt
ons.bind(this)); | 181 treeOutline.toggleEditAsHTML(node, startEditing, this._updateToolbarButt
ons.bind(this)); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 }, | 361 }, |
| 360 | 362 |
| 361 onResize: function() | 363 onResize: function() |
| 362 { | 364 { |
| 363 this._updateTreeOutlineVisibleWidth(); | 365 this._updateTreeOutlineVisibleWidth(); |
| 364 }, | 366 }, |
| 365 | 367 |
| 366 /** | 368 /** |
| 367 * @param {!WebInspector.Event} event | 369 * @param {!WebInspector.Event} event |
| 368 */ | 370 */ |
| 369 _decoratorsChanged: function(event) | |
| 370 { | |
| 371 var node = /** @type {!WebInspector.DOMNode} */ (event.data["node"]); | |
| 372 this._treeOutlineForNode(node).updateOpenCloseTags(node); | |
| 373 this._updateToolbarButtons(); | |
| 374 }, | |
| 375 | |
| 376 /** | |
| 377 * @param {!WebInspector.Event} event | |
| 378 */ | |
| 379 _onNodePicked: function(event) | 371 _onNodePicked: function(event) |
| 380 { | 372 { |
| 381 if (!this.sidebarPanes.styles.isEditingSelector()) | 373 if (!this.sidebarPanes.styles.isEditingSelector()) |
| 382 return; | 374 return; |
| 383 this.sidebarPanes.styles.updateEditingSelectorForNode(/** @type {!WebIns
pector.DOMNode} */(event.data)); | 375 this.sidebarPanes.styles.updateEditingSelectorForNode(/** @type {!WebIns
pector.DOMNode} */(event.data)); |
| 384 }, | 376 }, |
| 385 | 377 |
| 386 /** | 378 /** |
| 387 * @param {!WebInspector.Event} event | 379 * @param {!WebInspector.Event} event |
| 388 */ | 380 */ |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1236 */ | 1228 */ |
| 1237 handleAction: function(context, actionId) | 1229 handleAction: function(context, actionId) |
| 1238 { | 1230 { |
| 1239 var elementsPanel = WebInspector.ElementsPanel.instance(); | 1231 var elementsPanel = WebInspector.ElementsPanel.instance(); |
| 1240 if (actionId === "elements.hide-element") | 1232 if (actionId === "elements.hide-element") |
| 1241 elementsPanel._toggleHideElement(); | 1233 elementsPanel._toggleHideElement(); |
| 1242 else if (actionId === "elements.edit-as-html") | 1234 else if (actionId === "elements.edit-as-html") |
| 1243 elementsPanel._toggleEditAsHTML(); | 1235 elementsPanel._toggleEditAsHTML(); |
| 1244 } | 1236 } |
| 1245 } | 1237 } |
| 1238 |
| 1239 /** |
| 1240 * @constructor |
| 1241 * @implements {WebInspector.DOMPresentationUtils.MarkerDecorator} |
| 1242 */ |
| 1243 WebInspector.ElementsPanel.PseudoStateMarkerDecorator = function() |
| 1244 { |
| 1245 } |
| 1246 |
| 1247 WebInspector.ElementsPanel.PseudoStateMarkerDecorator.prototype = { |
| 1248 /** |
| 1249 * @override |
| 1250 * @param {!WebInspector.DOMNode} node |
| 1251 * @return {?string} |
| 1252 */ |
| 1253 decorate: function(node) |
| 1254 { |
| 1255 return WebInspector.UIString("Element state: %s", ":" + WebInspector.CSS
StyleModel.fromNode(node).pseudoState(node).join(", :")); |
| 1256 } |
| 1257 } |
| 1258 |
| 1259 /** |
| 1260 * @constructor |
| 1261 * @implements {WebInspector.DOMPresentationUtils.MarkerDecorator} |
| 1262 */ |
| 1263 WebInspector.ElementsPanel.HiddenMarkerDecorator = function() |
| 1264 { |
| 1265 } |
| 1266 |
| 1267 WebInspector.ElementsPanel.HiddenMarkerDecorator.prototype = { |
| 1268 /** |
| 1269 * @override |
| 1270 * @param {!WebInspector.DOMNode} node |
| 1271 * @return {?string} |
| 1272 */ |
| 1273 decorate: function(node) |
| 1274 { |
| 1275 return WebInspector.UIString("Element is hidden"); |
| 1276 } |
| 1277 } |
| OLD | NEW |