Chromium Code Reviews| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 var stackElement = this._searchableView.element; | 50 var stackElement = this._searchableView.element; |
| 51 | 51 |
| 52 this.contentElement = stackElement.createChild("div"); | 52 this.contentElement = stackElement.createChild("div"); |
| 53 this.contentElement.id = "elements-content"; | 53 this.contentElement.id = "elements-content"; |
| 54 this.contentElement.classList.add("outline-disclosure"); | 54 this.contentElement.classList.add("outline-disclosure"); |
| 55 this.contentElement.classList.add("source-code"); | 55 this.contentElement.classList.add("source-code"); |
| 56 if (!WebInspector.settings.domWordWrap.get()) | 56 if (!WebInspector.settings.domWordWrap.get()) |
| 57 this.contentElement.classList.add("nowrap"); | 57 this.contentElement.classList.add("nowrap"); |
| 58 WebInspector.settings.domWordWrap.addChangeListener(this._domWordWrapSetting Changed.bind(this)); | 58 WebInspector.settings.domWordWrap.addChangeListener(this._domWordWrapSetting Changed.bind(this)); |
| 59 | 59 |
| 60 this.contentElement.addEventListener("contextmenu", this._contextMenuEventFi red.bind(this), true); | |
| 61 this._splitView.sidebarElement().addEventListener("contextmenu", this._sideb arContextMenuEventFired.bind(this), false); | 60 this._splitView.sidebarElement().addEventListener("contextmenu", this._sideb arContextMenuEventFired.bind(this), false); |
| 62 | 61 |
| 63 var crumbsContainer = stackElement.createChild("div"); | 62 var crumbsContainer = stackElement.createChild("div"); |
| 64 crumbsContainer.id = "elements-crumbs"; | 63 crumbsContainer.id = "elements-crumbs"; |
| 65 this.crumbsElement = crumbsContainer.createChild("div", "crumbs"); | 64 this.crumbsElement = crumbsContainer.createChild("div", "crumbs"); |
| 66 this.crumbsElement.addEventListener("mousemove", this._mouseMovedInCrumbs.bi nd(this), false); | 65 this.crumbsElement.addEventListener("mousemove", this._mouseMovedInCrumbs.bi nd(this), false); |
| 67 this.crumbsElement.addEventListener("mouseout", this._mouseMovedOutOfCrumbs. bind(this), false); | 66 this.crumbsElement.addEventListener("mouseout", this._mouseMovedOutOfCrumbs. bind(this), false); |
| 68 | 67 |
| 69 this.sidebarPanes = {}; | 68 this.sidebarPanes = {}; |
| 70 this.sidebarPanes.platformFonts = new WebInspector.PlatformFontsSidebarPane( ); | 69 this.sidebarPanes.platformFonts = new WebInspector.PlatformFontsSidebarPane( ); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 { | 122 { |
| 124 for (var i = 0; i < this._treeOutlines.length; ++i) | 123 for (var i = 0; i < this._treeOutlines.length; ++i) |
| 125 this._treeOutlines[i].setPickNodeMode(false); | 124 this._treeOutlines[i].setPickNodeMode(false); |
| 126 }, | 125 }, |
| 127 | 126 |
| 128 /** | 127 /** |
| 129 * @param {!WebInspector.Target} target | 128 * @param {!WebInspector.Target} target |
| 130 */ | 129 */ |
| 131 targetAdded: function(target) | 130 targetAdded: function(target) |
| 132 { | 131 { |
| 133 var treeOutline = new WebInspector.ElementsTreeOutline(target, true, tru e, this._populateContextMenu.bind(this), this._setPseudoClassForNode.bind(this)) ; | 132 var treeOutline = new WebInspector.ElementsTreeOutline(target, true, tru e, this._setPseudoClassForNode.bind(this)); |
| 134 treeOutline.wireToDOMModel(); | 133 treeOutline.wireToDOMModel(); |
| 135 treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.Sel ectedNodeChanged, this._selectedNodeChanged, this); | 134 treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.Sel ectedNodeChanged, this._selectedNodeChanged, this); |
| 136 treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.Nod ePicked, this._onNodePicked, this); | 135 treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.Nod ePicked, this._onNodePicked, this); |
| 137 treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.Ele mentsTreeUpdated, this._updateBreadcrumbIfNeeded, this); | 136 treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.Ele mentsTreeUpdated, this._updateBreadcrumbIfNeeded, this); |
| 138 this._treeOutlines.push(treeOutline); | 137 this._treeOutlines.push(treeOutline); |
| 139 this._targetToTreeOutline.set(target, treeOutline); | 138 this._targetToTreeOutline.set(target, treeOutline); |
| 140 | 139 |
| 141 // Perform attach if necessary. | 140 // Perform attach if necessary. |
| 142 if (this.isShowing()) | 141 if (this.isShowing()) |
| 143 this.wasShown(); | 142 this.wasShown(); |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 444 this._searchableView.updateSearchMatchesCount(this._searchResults.le ngth); | 443 this._searchableView.updateSearchMatchesCount(this._searchResults.le ngth); |
| 445 if (!this._searchResults.length) | 444 if (!this._searchResults.length) |
| 446 return; | 445 return; |
| 447 this._currentSearchResultIndex = -1; | 446 this._currentSearchResultIndex = -1; |
| 448 | 447 |
| 449 if (shouldJump) | 448 if (shouldJump) |
| 450 this._jumpToSearchResult(jumpBackwards ? -1 : 0); | 449 this._jumpToSearchResult(jumpBackwards ? -1 : 0); |
| 451 } | 450 } |
| 452 }, | 451 }, |
| 453 | 452 |
| 454 _contextMenuEventFired: function(event) | |
| 455 { | |
| 456 if (this.sidebarPanes.styles.isEditingSelector()) | |
| 457 return; | |
| 458 var contextMenu = new WebInspector.ContextMenu(event); | |
| 459 for (var i = 0; i < this._treeOutlines.length; ++i) | |
| 460 this._treeOutlines[i].populateContextMenu(contextMenu, event); | |
| 461 contextMenu.show(); | |
| 462 }, | |
| 463 | |
| 464 _domWordWrapSettingChanged: function(event) | 453 _domWordWrapSettingChanged: function(event) |
| 465 { | 454 { |
| 466 if (event.data) | 455 if (event.data) |
| 467 this.contentElement.classList.remove("nowrap"); | 456 this.contentElement.classList.remove("nowrap"); |
| 468 else | 457 else |
| 469 this.contentElement.classList.add("nowrap"); | 458 this.contentElement.classList.add("nowrap"); |
| 470 | 459 |
| 471 var selectedNode = this.selectedDOMNode(); | 460 var selectedNode = this.selectedDOMNode(); |
| 472 if (!selectedNode) | 461 if (!selectedNode) |
| 473 return; | 462 return; |
| 474 | 463 |
| 475 var treeElement = this._treeElementForNode(selectedNode); | 464 var treeElement = this._treeElementForNode(selectedNode); |
| 476 if (treeElement) | 465 if (treeElement) |
| 477 treeElement.updateSelection(); // Recalculate selection highlight di mensions. | 466 treeElement.updateSelection(); // Recalculate selection highlight di mensions. |
| 478 }, | 467 }, |
| 479 | 468 |
| 480 switchToAndFocus: function(node) | 469 switchToAndFocus: function(node) |
| 481 { | 470 { |
| 482 // Reset search restore. | 471 // Reset search restore. |
| 483 this._searchableView.cancelSearch(); | 472 this._searchableView.cancelSearch(); |
| 484 WebInspector.inspectorView.setCurrentPanel(this); | 473 WebInspector.inspectorView.setCurrentPanel(this); |
| 485 this.selectDOMNode(node, true); | 474 this.selectDOMNode(node, true); |
| 486 }, | 475 }, |
| 487 | 476 |
| 488 _populateContextMenu: function(contextMenu, node) | |
| 489 { | |
| 490 // Add debbuging-related actions | |
| 491 contextMenu.appendSeparator(); | |
| 492 var pane = WebInspector.domBreakpointsSidebarPane; | |
| 493 pane.populateNodeContextMenu(node, contextMenu); | |
| 494 }, | |
| 495 | |
| 496 /** | 477 /** |
| 497 * @param {!Element} element | 478 * @param {!Element} element |
| 498 * @param {!Event} event | 479 * @param {!Event} event |
| 499 * @return {!Element|!AnchorBox|undefined} | 480 * @return {!Element|!AnchorBox|undefined} |
| 500 */ | 481 */ |
| 501 _getPopoverAnchor: function(element, event) | 482 _getPopoverAnchor: function(element, event) |
| 502 { | 483 { |
| 503 var anchor = element.enclosingNodeOrSelfWithClass("webkit-html-resource- link"); | 484 var anchor = element.enclosingNodeOrSelfWithClass("webkit-html-resource- link"); |
| 504 if (!anchor || !anchor.href) | 485 if (!anchor || !anchor.href) |
| 505 return; | 486 return; |
| (...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1285 * @param {!WebInspector.ContextMenu} contextMenu | 1266 * @param {!WebInspector.ContextMenu} contextMenu |
| 1286 * @param {!Object} object | 1267 * @param {!Object} object |
| 1287 */ | 1268 */ |
| 1288 appendApplicableItems: function(event, contextMenu, object) | 1269 appendApplicableItems: function(event, contextMenu, object) |
| 1289 { | 1270 { |
| 1290 if (!(object instanceof WebInspector.RemoteObject && (/** @type {!WebIns pector.RemoteObject} */ (object)).isNode()) | 1271 if (!(object instanceof WebInspector.RemoteObject && (/** @type {!WebIns pector.RemoteObject} */ (object)).isNode()) |
| 1291 && !(object instanceof WebInspector.DOMNode) | 1272 && !(object instanceof WebInspector.DOMNode) |
| 1292 && !(object instanceof WebInspector.DeferredDOMNode)) { | 1273 && !(object instanceof WebInspector.DeferredDOMNode)) { |
| 1293 return; | 1274 return; |
| 1294 } | 1275 } |
| 1276 | |
| 1277 // Add debbuging-related actions | |
| 1278 if (object instanceof WebInspector.DOMNode) { | |
| 1279 contextMenu.appendSeparator(); | |
| 1280 WebInspector.domBreakpointsSidebarPane.populateNodeContextMenu(objec t, contextMenu); | |
| 1281 } | |
| 1282 | |
| 1295 // Skip adding "Reveal..." menu item for our own tree outline. | 1283 // Skip adding "Reveal..." menu item for our own tree outline. |
| 1296 if (this.element.isAncestor(/** @type {!Node} */ (event.target))) | 1284 if (this.element.isAncestor(/** @type {!Node} */ (event.target))) |
| 1297 return; | 1285 return; |
| 1298 var commandCallback = WebInspector.Revealer.reveal.bind(WebInspector.Rev ealer, object); | 1286 var commandCallback = WebInspector.Revealer.reveal.bind(WebInspector.Rev ealer, object); |
| 1287 | |
|
sergeyv
2014/09/24 16:17:29
extra line
pfeldman
2014/09/24 16:23:13
Acknowledged.
| |
| 1299 contextMenu.appendItem(WebInspector.useLowerCaseMenuTitles() ? "Reveal i n Elements panel" : "Reveal in Elements Panel", commandCallback); | 1288 contextMenu.appendItem(WebInspector.useLowerCaseMenuTitles() ? "Reveal i n Elements panel" : "Reveal in Elements Panel", commandCallback); |
| 1300 }, | 1289 }, |
| 1301 | 1290 |
| 1302 _sidebarContextMenuEventFired: function(event) | 1291 _sidebarContextMenuEventFired: function(event) |
| 1303 { | 1292 { |
| 1304 var contextMenu = new WebInspector.ContextMenu(event); | 1293 var contextMenu = new WebInspector.ContextMenu(event); |
| 1305 contextMenu.show(); | 1294 contextMenu.show(); |
| 1306 }, | 1295 }, |
| 1307 | 1296 |
| 1308 _dockSideChanged: function() | 1297 _dockSideChanged: function() |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1614 /** | 1603 /** |
| 1615 * @suppressReceiverCheck | 1604 * @suppressReceiverCheck |
| 1616 * @this {Element} | 1605 * @this {Element} |
| 1617 */ | 1606 */ |
| 1618 function parentElement() | 1607 function parentElement() |
| 1619 { | 1608 { |
| 1620 return this.parentElement; | 1609 return this.parentElement; |
| 1621 } | 1610 } |
| 1622 } | 1611 } |
| 1623 } | 1612 } |
| OLD | NEW |