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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 this.element = shadowContainer; | 67 this.element = shadowContainer; |
| 68 | 68 |
| 69 this._includeRootDOMNode = !omitRootDOMNode; | 69 this._includeRootDOMNode = !omitRootDOMNode; |
| 70 this._selectEnabled = selectEnabled; | 70 this._selectEnabled = selectEnabled; |
| 71 /** @type {?SDK.DOMNode} */ | 71 /** @type {?SDK.DOMNode} */ |
| 72 this._rootDOMNode = null; | 72 this._rootDOMNode = null; |
| 73 /** @type {?SDK.DOMNode} */ | 73 /** @type {?SDK.DOMNode} */ |
| 74 this._selectedDOMNode = null; | 74 this._selectedDOMNode = null; |
| 75 | 75 |
| 76 this._visible = false; | 76 this._visible = false; |
| 77 this._shouldReportSelectedNodeChangedUMA = false; | |
| 77 | 78 |
| 78 this._popoverHelper = new UI.PopoverHelper(this._element); | 79 this._popoverHelper = new UI.PopoverHelper(this._element); |
| 79 this._popoverHelper.initializeCallbacks(this._getPopoverAnchor.bind(this), t his._showPopover.bind(this)); | 80 this._popoverHelper.initializeCallbacks(this._getPopoverAnchor.bind(this), t his._showPopover.bind(this)); |
| 80 this._popoverHelper.setTimeout(0, 100); | 81 this._popoverHelper.setTimeout(0, 100); |
| 81 | 82 |
| 82 /** @type {!Map<!SDK.DOMNode, !Elements.ElementsTreeOutline.UpdateRecord>} * / | 83 /** @type {!Map<!SDK.DOMNode, !Elements.ElementsTreeOutline.UpdateRecord>} * / |
| 83 this._updateRecords = new Map(); | 84 this._updateRecords = new Map(); |
| 84 /** @type {!Set<!Elements.ElementsTreeElement>} */ | 85 /** @type {!Set<!Elements.ElementsTreeElement>} */ |
| 85 this._treeElementsBeingUpdated = new Set(); | 86 this._treeElementsBeingUpdated = new Set(); |
| 86 | 87 |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 } | 388 } |
| 388 | 389 |
| 389 if (selectedNode) | 390 if (selectedNode) |
| 390 this._revealAndSelectNode(selectedNode, true); | 391 this._revealAndSelectNode(selectedNode, true); |
| 391 } | 392 } |
| 392 | 393 |
| 393 /** | 394 /** |
| 394 * @param {boolean} focus | 395 * @param {boolean} focus |
| 395 */ | 396 */ |
| 396 _selectedNodeChanged(focus) { | 397 _selectedNodeChanged(focus) { |
| 398 // Don't want to track first time selecting node because user may | |
| 399 // just be trying to open DevTools with "Inspect" | |
| 400 if (this._shouldReportSelectedNodeChangedUMA) | |
| 401 Host.userMetrics.actionTaken(Host.UserMetrics.Action.ChangeInspectedNodeIn ElementsPanel); | |
| 402 this._shouldReportSelectedNodeChangedUMA = true; | |
| 397 this.dispatchEventToListeners( | 403 this.dispatchEventToListeners( |
| 398 Elements.ElementsTreeOutline.Events.SelectedNodeChanged, {node: this._se lectedDOMNode, focus: focus}); | 404 Elements.ElementsTreeOutline.Events.SelectedNodeChanged, {node: this._se lectedDOMNode, focus: focus}); |
| 399 } | 405 } |
| 400 | 406 |
| 401 /** | 407 /** |
| 402 * @param {!Array.<!SDK.DOMNode>} nodes | 408 * @param {!Array.<!SDK.DOMNode>} nodes |
| 403 */ | 409 */ |
| 404 _fireElementsTreeUpdated(nodes) { | 410 _fireElementsTreeUpdated(nodes) { |
| 405 this.dispatchEventToListeners(Elements.ElementsTreeOutline.Events.ElementsTr eeUpdated, nodes); | 411 this.dispatchEventToListeners(Elements.ElementsTreeOutline.Events.ElementsTr eeUpdated, nodes); |
| 406 } | 412 } |
| (...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1674 } | 1680 } |
| 1675 | 1681 |
| 1676 /** | 1682 /** |
| 1677 * @override | 1683 * @override |
| 1678 * @param {boolean=} selectedByUser | 1684 * @param {boolean=} selectedByUser |
| 1679 * @return {boolean} | 1685 * @return {boolean} |
| 1680 */ | 1686 */ |
| 1681 onselect(selectedByUser) { | 1687 onselect(selectedByUser) { |
| 1682 if (!selectedByUser) | 1688 if (!selectedByUser) |
| 1683 return true; | 1689 return true; |
| 1684 this._nodeShortcut.deferredNode.highlight(); | 1690 this._nodeShortcut.deferredNode.highlight(); |
|
pfeldman
2017/02/25 01:34:36
This is a good place for manual selection tracking
chenwilliam
2017/02/28 22:31:17
I tried putting it here - but AFAICT it never gets
| |
| 1685 this._nodeShortcut.deferredNode.resolve(resolved.bind(this)); | 1691 this._nodeShortcut.deferredNode.resolve(resolved.bind(this)); |
| 1686 /** | 1692 /** |
| 1687 * @param {?SDK.DOMNode} node | 1693 * @param {?SDK.DOMNode} node |
| 1688 * @this {Elements.ElementsTreeOutline.ShortcutTreeElement} | 1694 * @this {Elements.ElementsTreeOutline.ShortcutTreeElement} |
| 1689 */ | 1695 */ |
| 1690 function resolved(node) { | 1696 function resolved(node) { |
| 1691 if (node) { | 1697 if (node) { |
| 1692 this.treeOutline._selectedDOMNode = node; | 1698 this.treeOutline._selectedDOMNode = node; |
| 1693 this.treeOutline._selectedNodeChanged(); | 1699 this.treeOutline._selectedNodeChanged(); |
| 1694 } | 1700 } |
| 1695 } | 1701 } |
| 1696 return true; | 1702 return true; |
| 1697 } | 1703 } |
| 1698 }; | 1704 }; |
| OLD | NEW |