| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 this.sidebarPanes.metrics.addEventListener("metrics edited", this._metricsPa
neEdited, this); | 104 this.sidebarPanes.metrics.addEventListener("metrics edited", this._metricsPa
neEdited, this); |
| 105 this._extensionSidebarPanes = []; | 105 this._extensionSidebarPanes = []; |
| 106 | 106 |
| 107 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve
nts.DockSideChanged, this._dockSideChanged.bind(this)); | 107 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve
nts.DockSideChanged, this._dockSideChanged.bind(this)); |
| 108 WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(thi
s._dockSideChanged.bind(this)); | 108 WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(thi
s._dockSideChanged.bind(this)); |
| 109 this._dockSideChanged(); | 109 this._dockSideChanged(); |
| 110 | 110 |
| 111 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this._get
PopoverAnchor.bind(this), this._showPopover.bind(this)); | 111 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this._get
PopoverAnchor.bind(this), this._showPopover.bind(this)); |
| 112 this._popoverHelper.setTimeout(0); | 112 this._popoverHelper.setTimeout(0); |
| 113 | 113 |
| 114 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.Document
Updated, this._documentUpdatedEvent, this); | 114 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.Document
Updated, this._documentUpdatedEvent, this); |
| 115 WebInspector.settings.showUAShadowDOM.addChangeListener(this._showUAShadowDO
MChanged.bind(this)); | 115 WebInspector.settings.showUAShadowDOM.addChangeListener(this._showUAShadowDO
MChanged.bind(this)); |
| 116 | 116 |
| 117 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Mod
elWasEnabled, this._updateSidebars, this); | 117 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Mod
elWasEnabled, this._updateSidebars, this); |
| 118 } | 118 } |
| 119 | 119 |
| 120 WebInspector.ElementsPanel.prototype = { | 120 WebInspector.ElementsPanel.prototype = { |
| 121 _updateTreeOutlineVisibleWidth: function() | 121 _updateTreeOutlineVisibleWidth: function() |
| 122 { | 122 { |
| 123 if (!this.treeOutline) | 123 if (!this.treeOutline) |
| 124 return; | 124 return; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 153 if (this.treeOutline.element.parentElement !== this.contentElement) | 153 if (this.treeOutline.element.parentElement !== this.contentElement) |
| 154 this.contentElement.appendChild(this.treeOutline.element); | 154 this.contentElement.appendChild(this.treeOutline.element); |
| 155 | 155 |
| 156 WebInspector.Panel.prototype.wasShown.call(this); | 156 WebInspector.Panel.prototype.wasShown.call(this); |
| 157 | 157 |
| 158 this.updateBreadcrumb(); | 158 this.updateBreadcrumb(); |
| 159 this.treeOutline.updateSelection(); | 159 this.treeOutline.updateSelection(); |
| 160 this.treeOutline.setVisible(true); | 160 this.treeOutline.setVisible(true); |
| 161 | 161 |
| 162 if (!this.treeOutline.rootDOMNode) | 162 if (!this.treeOutline.rootDOMNode) |
| 163 if (WebInspector.domAgent.existingDocument()) | 163 if (WebInspector.domModel.existingDocument()) |
| 164 this._documentUpdated(WebInspector.domAgent.existingDocument()); | 164 this._documentUpdated(WebInspector.domModel.existingDocument()); |
| 165 else | 165 else |
| 166 WebInspector.domAgent.requestDocument(); | 166 WebInspector.domModel.requestDocument(); |
| 167 }, | 167 }, |
| 168 | 168 |
| 169 willHide: function() | 169 willHide: function() |
| 170 { | 170 { |
| 171 WebInspector.domAgent.hideDOMNodeHighlight(); | 171 WebInspector.domModel.hideDOMNodeHighlight(); |
| 172 this.treeOutline.setVisible(false); | 172 this.treeOutline.setVisible(false); |
| 173 this._popoverHelper.hidePopover(); | 173 this._popoverHelper.hidePopover(); |
| 174 | 174 |
| 175 // Detach heavy component on hide | 175 // Detach heavy component on hide |
| 176 this.contentElement.removeChild(this.treeOutline.element); | 176 this.contentElement.removeChild(this.treeOutline.element); |
| 177 | 177 |
| 178 WebInspector.Panel.prototype.willHide.call(this); | 178 WebInspector.Panel.prototype.willHide.call(this); |
| 179 }, | 179 }, |
| 180 | 180 |
| 181 onResize: function() | 181 onResize: function() |
| (...skipping 11 matching lines...) Expand all Loading... |
| 193 delete this._omitDefaultSelection; | 193 delete this._omitDefaultSelection; |
| 194 }, | 194 }, |
| 195 | 195 |
| 196 /** | 196 /** |
| 197 * @param {!DOMAgent.NodeId} nodeId | 197 * @param {!DOMAgent.NodeId} nodeId |
| 198 * @param {string} pseudoClass | 198 * @param {string} pseudoClass |
| 199 * @param {boolean} enable | 199 * @param {boolean} enable |
| 200 */ | 200 */ |
| 201 _setPseudoClassForNodeId: function(nodeId, pseudoClass, enable) | 201 _setPseudoClassForNodeId: function(nodeId, pseudoClass, enable) |
| 202 { | 202 { |
| 203 var node = WebInspector.domAgent.nodeForId(nodeId); | 203 var node = WebInspector.domModel.nodeForId(nodeId); |
| 204 if (!node) | 204 if (!node) |
| 205 return; | 205 return; |
| 206 | 206 |
| 207 var pseudoClasses = node.getUserProperty(WebInspector.ElementsTreeOutlin
e.PseudoStateDecorator.PropertyName); | 207 var pseudoClasses = node.getUserProperty(WebInspector.ElementsTreeOutlin
e.PseudoStateDecorator.PropertyName); |
| 208 if (enable) { | 208 if (enable) { |
| 209 pseudoClasses = pseudoClasses || []; | 209 pseudoClasses = pseudoClasses || []; |
| 210 if (pseudoClasses.indexOf(pseudoClass) >= 0) | 210 if (pseudoClasses.indexOf(pseudoClass) >= 0) |
| 211 return; | 211 return; |
| 212 pseudoClasses.push(pseudoClass); | 212 pseudoClasses.push(pseudoClass); |
| 213 node.setUserProperty(WebInspector.ElementsTreeOutline.PseudoStateDec
orator.PropertyName, pseudoClasses); | 213 node.setUserProperty(WebInspector.ElementsTreeOutline.PseudoStateDec
orator.PropertyName, pseudoClasses); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 273 |
| 274 _documentUpdated: function(inspectedRootDocument) | 274 _documentUpdated: function(inspectedRootDocument) |
| 275 { | 275 { |
| 276 this._reset(); | 276 this._reset(); |
| 277 this.searchCanceled(); | 277 this.searchCanceled(); |
| 278 | 278 |
| 279 this.treeOutline.rootDOMNode = inspectedRootDocument; | 279 this.treeOutline.rootDOMNode = inspectedRootDocument; |
| 280 | 280 |
| 281 if (!inspectedRootDocument) { | 281 if (!inspectedRootDocument) { |
| 282 if (this.isShowing()) | 282 if (this.isShowing()) |
| 283 WebInspector.domAgent.requestDocument(); | 283 WebInspector.domModel.requestDocument(); |
| 284 return; | 284 return; |
| 285 } | 285 } |
| 286 | 286 |
| 287 WebInspector.domBreakpointsSidebarPane.restoreBreakpoints(); | 287 WebInspector.domBreakpointsSidebarPane.restoreBreakpoints(); |
| 288 | 288 |
| 289 /** | 289 /** |
| 290 * @this {WebInspector.ElementsPanel} | 290 * @this {WebInspector.ElementsPanel} |
| 291 * @param {?WebInspector.DOMNode} candidateFocusNode | 291 * @param {?WebInspector.DOMNode} candidateFocusNode |
| 292 */ | 292 */ |
| 293 function selectNode(candidateFocusNode) | 293 function selectNode(candidateFocusNode) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 306 /** | 306 /** |
| 307 * @param {?DOMAgent.NodeId} nodeId | 307 * @param {?DOMAgent.NodeId} nodeId |
| 308 * @this {WebInspector.ElementsPanel} | 308 * @this {WebInspector.ElementsPanel} |
| 309 */ | 309 */ |
| 310 function selectLastSelectedNode(nodeId) | 310 function selectLastSelectedNode(nodeId) |
| 311 { | 311 { |
| 312 if (this.selectedDOMNode()) { | 312 if (this.selectedDOMNode()) { |
| 313 // Focused node has been explicitly set while reaching out for t
he last selected node. | 313 // Focused node has been explicitly set while reaching out for t
he last selected node. |
| 314 return; | 314 return; |
| 315 } | 315 } |
| 316 var node = nodeId ? WebInspector.domAgent.nodeForId(nodeId) : null; | 316 var node = nodeId ? WebInspector.domModel.nodeForId(nodeId) : null; |
| 317 selectNode.call(this, node); | 317 selectNode.call(this, node); |
| 318 } | 318 } |
| 319 | 319 |
| 320 if (this._omitDefaultSelection) | 320 if (this._omitDefaultSelection) |
| 321 return; | 321 return; |
| 322 | 322 |
| 323 if (this._selectedPathOnReset) | 323 if (this._selectedPathOnReset) |
| 324 WebInspector.domAgent.pushNodeByPathToFrontend(this._selectedPathOnR
eset, selectLastSelectedNode.bind(this)); | 324 WebInspector.domModel.pushNodeByPathToFrontend(this._selectedPathOnR
eset, selectLastSelectedNode.bind(this)); |
| 325 else | 325 else |
| 326 selectNode.call(this, null); | 326 selectNode.call(this, null); |
| 327 delete this._selectedPathOnReset; | 327 delete this._selectedPathOnReset; |
| 328 }, | 328 }, |
| 329 | 329 |
| 330 searchCanceled: function() | 330 searchCanceled: function() |
| 331 { | 331 { |
| 332 delete this._searchQuery; | 332 delete this._searchQuery; |
| 333 this._hideSearchHighlights(); | 333 this._hideSearchHighlights(); |
| 334 | 334 |
| 335 this._searchableView.updateSearchMatchesCount(0); | 335 this._searchableView.updateSearchMatchesCount(0); |
| 336 | 336 |
| 337 delete this._currentSearchResultIndex; | 337 delete this._currentSearchResultIndex; |
| 338 delete this._searchResults; | 338 delete this._searchResults; |
| 339 WebInspector.domAgent.cancelSearch(); | 339 WebInspector.domModel.cancelSearch(); |
| 340 }, | 340 }, |
| 341 | 341 |
| 342 /** | 342 /** |
| 343 * @param {string} query | 343 * @param {string} query |
| 344 * @param {boolean} shouldJump | 344 * @param {boolean} shouldJump |
| 345 */ | 345 */ |
| 346 performSearch: function(query, shouldJump) | 346 performSearch: function(query, shouldJump) |
| 347 { | 347 { |
| 348 // Call searchCanceled since it will reset everything we need before doi
ng a new search. | 348 // Call searchCanceled since it will reset everything we need before doi
ng a new search. |
| 349 this.searchCanceled(); | 349 this.searchCanceled(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 362 { | 362 { |
| 363 this._searchableView.updateSearchMatchesCount(resultCount); | 363 this._searchableView.updateSearchMatchesCount(resultCount); |
| 364 if (!resultCount) | 364 if (!resultCount) |
| 365 return; | 365 return; |
| 366 | 366 |
| 367 this._searchResults = new Array(resultCount); | 367 this._searchResults = new Array(resultCount); |
| 368 this._currentSearchResultIndex = -1; | 368 this._currentSearchResultIndex = -1; |
| 369 if (shouldJump) | 369 if (shouldJump) |
| 370 this.jumpToNextSearchResult(); | 370 this.jumpToNextSearchResult(); |
| 371 } | 371 } |
| 372 WebInspector.domAgent.performSearch(whitespaceTrimmedQuery, resultCountC
allback.bind(this)); | 372 WebInspector.domModel.performSearch(whitespaceTrimmedQuery, resultCountC
allback.bind(this)); |
| 373 }, | 373 }, |
| 374 | 374 |
| 375 _contextMenuEventFired: function(event) | 375 _contextMenuEventFired: function(event) |
| 376 { | 376 { |
| 377 var contextMenu = new WebInspector.ContextMenu(event); | 377 var contextMenu = new WebInspector.ContextMenu(event); |
| 378 this.treeOutline.populateContextMenu(contextMenu, event); | 378 this.treeOutline.populateContextMenu(contextMenu, event); |
| 379 contextMenu.show(); | 379 contextMenu.show(); |
| 380 }, | 380 }, |
| 381 | 381 |
| 382 _domWordWrapSettingChanged: function(event) | 382 _domWordWrapSettingChanged: function(event) |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 * @this {WebInspector.ElementsPanel} | 530 * @this {WebInspector.ElementsPanel} |
| 531 */ | 531 */ |
| 532 function searchCallback(node) | 532 function searchCallback(node) |
| 533 { | 533 { |
| 534 searchResults[index] = node; | 534 searchResults[index] = node; |
| 535 this._highlightCurrentSearchResult(); | 535 this._highlightCurrentSearchResult(); |
| 536 } | 536 } |
| 537 | 537 |
| 538 if (typeof searchResult === "undefined") { | 538 if (typeof searchResult === "undefined") { |
| 539 // No data for slot, request it. | 539 // No data for slot, request it. |
| 540 WebInspector.domAgent.searchResult(index, searchCallback.bind(this))
; | 540 WebInspector.domModel.searchResult(index, searchCallback.bind(this))
; |
| 541 return; | 541 return; |
| 542 } | 542 } |
| 543 | 543 |
| 544 this._searchableView.updateCurrentMatchIndex(index); | 544 this._searchableView.updateCurrentMatchIndex(index); |
| 545 | 545 |
| 546 var treeElement = this.treeOutline.findTreeElement(searchResult); | 546 var treeElement = this.treeOutline.findTreeElement(searchResult); |
| 547 if (treeElement) { | 547 if (treeElement) { |
| 548 treeElement.highlightSearchResults(this._searchQuery); | 548 treeElement.highlightSearchResults(this._searchQuery); |
| 549 treeElement.reveal(); | 549 treeElement.reveal(); |
| 550 var matches = treeElement.listItemElement.getElementsByClassName("hi
ghlighted-search-result"); | 550 var matches = treeElement.listItemElement.getElementsByClassName("hi
ghlighted-search-result"); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 // Once metrics are edited, the Styles pane should be updated. | 613 // Once metrics are edited, the Styles pane should be updated. |
| 614 this.sidebarPanes.styles.needsUpdate = true; | 614 this.sidebarPanes.styles.needsUpdate = true; |
| 615 this.updateStyles(true); | 615 this.updateStyles(true); |
| 616 }, | 616 }, |
| 617 | 617 |
| 618 _mouseMovedInCrumbs: function(event) | 618 _mouseMovedInCrumbs: function(event) |
| 619 { | 619 { |
| 620 var nodeUnderMouse = document.elementFromPoint(event.pageX, event.pageY)
; | 620 var nodeUnderMouse = document.elementFromPoint(event.pageX, event.pageY)
; |
| 621 var crumbElement = nodeUnderMouse.enclosingNodeOrSelfWithClass("crumb"); | 621 var crumbElement = nodeUnderMouse.enclosingNodeOrSelfWithClass("crumb"); |
| 622 | 622 |
| 623 WebInspector.domAgent.highlightDOMNode(crumbElement ? crumbElement.repre
sentedObject.id : 0); | 623 WebInspector.domModel.highlightDOMNode(crumbElement ? crumbElement.repre
sentedObject.id : 0); |
| 624 | 624 |
| 625 if ("_mouseOutOfCrumbsTimeout" in this) { | 625 if ("_mouseOutOfCrumbsTimeout" in this) { |
| 626 clearTimeout(this._mouseOutOfCrumbsTimeout); | 626 clearTimeout(this._mouseOutOfCrumbsTimeout); |
| 627 delete this._mouseOutOfCrumbsTimeout; | 627 delete this._mouseOutOfCrumbsTimeout; |
| 628 } | 628 } |
| 629 }, | 629 }, |
| 630 | 630 |
| 631 _mouseMovedOutOfCrumbs: function(event) | 631 _mouseMovedOutOfCrumbs: function(event) |
| 632 { | 632 { |
| 633 var nodeUnderMouse = document.elementFromPoint(event.pageX, event.pageY)
; | 633 var nodeUnderMouse = document.elementFromPoint(event.pageX, event.pageY)
; |
| 634 if (nodeUnderMouse && nodeUnderMouse.isDescendant(this.crumbsElement)) | 634 if (nodeUnderMouse && nodeUnderMouse.isDescendant(this.crumbsElement)) |
| 635 return; | 635 return; |
| 636 | 636 |
| 637 WebInspector.domAgent.hideDOMNodeHighlight(); | 637 WebInspector.domModel.hideDOMNodeHighlight(); |
| 638 | 638 |
| 639 this._mouseOutOfCrumbsTimeout = setTimeout(this.updateBreadcrumbSizes.bi
nd(this), 1000); | 639 this._mouseOutOfCrumbsTimeout = setTimeout(this.updateBreadcrumbSizes.bi
nd(this), 1000); |
| 640 }, | 640 }, |
| 641 | 641 |
| 642 /** | 642 /** |
| 643 * @param {boolean=} forceUpdate | 643 * @param {boolean=} forceUpdate |
| 644 */ | 644 */ |
| 645 updateBreadcrumb: function(forceUpdate) | 645 updateBreadcrumb: function(forceUpdate) |
| 646 { | 646 { |
| 647 if (!this.isShowing()) | 647 if (!this.isShowing()) |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 * @param {!KeyboardEvent} event | 1056 * @param {!KeyboardEvent} event |
| 1057 */ | 1057 */ |
| 1058 handleShortcut: function(event) | 1058 handleShortcut: function(event) |
| 1059 { | 1059 { |
| 1060 /** | 1060 /** |
| 1061 * @this {WebInspector.ElementsPanel} | 1061 * @this {WebInspector.ElementsPanel} |
| 1062 */ | 1062 */ |
| 1063 function handleUndoRedo() | 1063 function handleUndoRedo() |
| 1064 { | 1064 { |
| 1065 if (WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && !even
t.shiftKey && event.keyIdentifier === "U+005A") { // Z key | 1065 if (WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && !even
t.shiftKey && event.keyIdentifier === "U+005A") { // Z key |
| 1066 WebInspector.domAgent.undo(this._updateSidebars.bind(this)); | 1066 WebInspector.domModel.undo(this._updateSidebars.bind(this)); |
| 1067 event.handled = true; | 1067 event.handled = true; |
| 1068 return; | 1068 return; |
| 1069 } | 1069 } |
| 1070 | 1070 |
| 1071 var isRedoKey = WebInspector.isMac() ? event.metaKey && event.shiftK
ey && event.keyIdentifier === "U+005A" : // Z key | 1071 var isRedoKey = WebInspector.isMac() ? event.metaKey && event.shiftK
ey && event.keyIdentifier === "U+005A" : // Z key |
| 1072 event.ctrlKey && event.keyIde
ntifier === "U+0059"; // Y key | 1072 event.ctrlKey && event.keyIde
ntifier === "U+0059"; // Y key |
| 1073 if (isRedoKey) { | 1073 if (isRedoKey) { |
| 1074 DOMAgent.redo(this._updateSidebars.bind(this)); | 1074 DOMAgent.redo(this._updateSidebars.bind(this)); |
| 1075 event.handled = true; | 1075 event.handled = true; |
| 1076 } | 1076 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 return userAgentShadowRoot ? /** @type {!WebInspector.DOMNode} */ (userA
gentShadowRoot.parentNode) : node; | 1109 return userAgentShadowRoot ? /** @type {!WebInspector.DOMNode} */ (userA
gentShadowRoot.parentNode) : node; |
| 1110 }, | 1110 }, |
| 1111 | 1111 |
| 1112 /** | 1112 /** |
| 1113 * @param {!DOMAgent.NodeId} nodeId | 1113 * @param {!DOMAgent.NodeId} nodeId |
| 1114 */ | 1114 */ |
| 1115 revealAndSelectNode: function(nodeId) | 1115 revealAndSelectNode: function(nodeId) |
| 1116 { | 1116 { |
| 1117 WebInspector.inspectorView.setCurrentPanel(this); | 1117 WebInspector.inspectorView.setCurrentPanel(this); |
| 1118 | 1118 |
| 1119 var node = WebInspector.domAgent.nodeForId(nodeId); | 1119 var node = WebInspector.domModel.nodeForId(nodeId); |
| 1120 if (!node) | 1120 if (!node) |
| 1121 return; | 1121 return; |
| 1122 | 1122 |
| 1123 node = WebInspector.settings.showUAShadowDOM.get() ? node : this._leaveU
serAgentShadowDOM(node); | 1123 node = WebInspector.settings.showUAShadowDOM.get() ? node : this._leaveU
serAgentShadowDOM(node); |
| 1124 WebInspector.domAgent.highlightDOMNodeForTwoSeconds(nodeId); | 1124 WebInspector.domModel.highlightDOMNodeForTwoSeconds(nodeId); |
| 1125 this.selectDOMNode(node, true); | 1125 this.selectDOMNode(node, true); |
| 1126 }, | 1126 }, |
| 1127 | 1127 |
| 1128 /** | 1128 /** |
| 1129 * @param {!WebInspector.ContextMenu} contextMenu | 1129 * @param {!WebInspector.ContextMenu} contextMenu |
| 1130 * @param {!Object} target | 1130 * @param {!Object} target |
| 1131 */ | 1131 */ |
| 1132 appendApplicableItems: function(event, contextMenu, target) | 1132 appendApplicableItems: function(event, contextMenu, target) |
| 1133 { | 1133 { |
| 1134 /** | 1134 /** |
| 1135 * @param {?DOMAgent.NodeId} nodeId | 1135 * @param {?DOMAgent.NodeId} nodeId |
| 1136 */ | 1136 */ |
| 1137 function selectNode(nodeId) | 1137 function selectNode(nodeId) |
| 1138 { | 1138 { |
| 1139 if (nodeId) | 1139 if (nodeId) |
| 1140 WebInspector.domAgent.inspectElement(nodeId); | 1140 WebInspector.domModel.inspectElement(nodeId); |
| 1141 } | 1141 } |
| 1142 | 1142 |
| 1143 /** | 1143 /** |
| 1144 * @param {!WebInspector.RemoteObject} remoteObject | 1144 * @param {!WebInspector.RemoteObject} remoteObject |
| 1145 */ | 1145 */ |
| 1146 function revealElement(remoteObject) | 1146 function revealElement(remoteObject) |
| 1147 { | 1147 { |
| 1148 remoteObject.pushNodeToFrontend(selectNode); | 1148 remoteObject.pushNodeToFrontend(selectNode); |
| 1149 } | 1149 } |
| 1150 | 1150 |
| 1151 var commandCallback; | 1151 var commandCallback; |
| 1152 if (target instanceof WebInspector.RemoteObject) { | 1152 if (target instanceof WebInspector.RemoteObject) { |
| 1153 var remoteObject = /** @type {!WebInspector.RemoteObject} */ (target
); | 1153 var remoteObject = /** @type {!WebInspector.RemoteObject} */ (target
); |
| 1154 if (remoteObject.subtype === "node") | 1154 if (remoteObject.subtype === "node") |
| 1155 commandCallback = revealElement.bind(null, remoteObject); | 1155 commandCallback = revealElement.bind(null, remoteObject); |
| 1156 } else if (target instanceof WebInspector.DOMNode) { | 1156 } else if (target instanceof WebInspector.DOMNode) { |
| 1157 var domNode = /** @type {!WebInspector.DOMNode} */ (target); | 1157 var domNode = /** @type {!WebInspector.DOMNode} */ (target); |
| 1158 if (domNode.id) | 1158 if (domNode.id) |
| 1159 commandCallback = WebInspector.domAgent.inspectElement.bind(WebI
nspector.domAgent, domNode.id); | 1159 commandCallback = WebInspector.domModel.inspectElement.bind(WebI
nspector.domModel, domNode.id); |
| 1160 } | 1160 } |
| 1161 if (!commandCallback) | 1161 if (!commandCallback) |
| 1162 return; | 1162 return; |
| 1163 // Skip adding "Reveal..." menu item for our own tree outline. | 1163 // Skip adding "Reveal..." menu item for our own tree outline. |
| 1164 if (this.treeOutline.element.isAncestor(event.target)) | 1164 if (this.treeOutline.element.isAncestor(event.target)) |
| 1165 return; | 1165 return; |
| 1166 contextMenu.appendItem(WebInspector.useLowerCaseMenuTitles() ? "Reveal i
n Elements panel" : "Reveal in Elements Panel", commandCallback); | 1166 contextMenu.appendItem(WebInspector.useLowerCaseMenuTitles() ? "Reveal i
n Elements panel" : "Reveal in Elements Panel", commandCallback); |
| 1167 }, | 1167 }, |
| 1168 | 1168 |
| 1169 _sidebarContextMenuEventFired: function(event) | 1169 _sidebarContextMenuEventFired: function(event) |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1337 return; | 1337 return; |
| 1338 | 1338 |
| 1339 if (WebInspector.inspectElementModeController && WebInspector.inspectEle
mentModeController.enabled()) { | 1339 if (WebInspector.inspectElementModeController && WebInspector.inspectEle
mentModeController.enabled()) { |
| 1340 InspectorFrontendHost.bringToFront(); | 1340 InspectorFrontendHost.bringToFront(); |
| 1341 WebInspector.inspectElementModeController.disable(); | 1341 WebInspector.inspectElementModeController.disable(); |
| 1342 } | 1342 } |
| 1343 | 1343 |
| 1344 /** @type {!WebInspector.ElementsPanel} */ (WebInspector.inspectorView.p
anel("elements")).revealAndSelectNode(node.id); | 1344 /** @type {!WebInspector.ElementsPanel} */ (WebInspector.inspectorView.p
anel("elements")).revealAndSelectNode(node.id); |
| 1345 } | 1345 } |
| 1346 } | 1346 } |
| OLD | NEW |