| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 this._popoverHelper.setTimeout(0, 100); | 78 this._popoverHelper.setTimeout(0, 100); |
| 79 | 79 |
| 80 /** @type {!Map<!WebInspector.DOMNode, !WebInspector.ElementsTreeOutline.Upd
ateRecord>} */ | 80 /** @type {!Map<!WebInspector.DOMNode, !WebInspector.ElementsTreeOutline.Upd
ateRecord>} */ |
| 81 this._updateRecords = new Map(); | 81 this._updateRecords = new Map(); |
| 82 /** @type {!Set<!WebInspector.ElementsTreeElement>} */ | 82 /** @type {!Set<!WebInspector.ElementsTreeElement>} */ |
| 83 this._treeElementsBeingUpdated = new Set(); | 83 this._treeElementsBeingUpdated = new Set(); |
| 84 | 84 |
| 85 this._domModel.addEventListener(WebInspector.DOMModel.Events.MarkersChanged,
this._markersChanged, this); | 85 this._domModel.addEventListener(WebInspector.DOMModel.Events.MarkersChanged,
this._markersChanged, this); |
| 86 this._showHTMLCommentsSetting = WebInspector.moduleSetting("showHTMLComments
"); | 86 this._showHTMLCommentsSetting = WebInspector.moduleSetting("showHTMLComments
"); |
| 87 this._showHTMLCommentsSetting.addChangeListener(this._onShowHTMLCommentsChan
ge.bind(this)); | 87 this._showHTMLCommentsSetting.addChangeListener(this._onShowHTMLCommentsChan
ge.bind(this)); |
| 88 } | 88 }; |
| 89 | 89 |
| 90 WebInspector.ElementsTreeOutline._treeOutlineSymbol = Symbol("treeOutline"); | 90 WebInspector.ElementsTreeOutline._treeOutlineSymbol = Symbol("treeOutline"); |
| 91 | 91 |
| 92 /** | 92 /** |
| 93 * @param {!WebInspector.DOMModel} domModel | 93 * @param {!WebInspector.DOMModel} domModel |
| 94 * @return {?WebInspector.ElementsTreeOutline} | 94 * @return {?WebInspector.ElementsTreeOutline} |
| 95 */ | 95 */ |
| 96 WebInspector.ElementsTreeOutline.forDOMModel = function(domModel) | 96 WebInspector.ElementsTreeOutline.forDOMModel = function(domModel) |
| 97 { | 97 { |
| 98 return domModel[WebInspector.ElementsTreeOutline._treeOutlineSymbol] || null
; | 98 return domModel[WebInspector.ElementsTreeOutline._treeOutlineSymbol] || null
; |
| 99 } | 99 }; |
| 100 | 100 |
| 101 /** @typedef {{node: !WebInspector.DOMNode, isCut: boolean}} */ | 101 /** @typedef {{node: !WebInspector.DOMNode, isCut: boolean}} */ |
| 102 WebInspector.ElementsTreeOutline.ClipboardData; | 102 WebInspector.ElementsTreeOutline.ClipboardData; |
| 103 | 103 |
| 104 /** @enum {symbol} */ | 104 /** @enum {symbol} */ |
| 105 WebInspector.ElementsTreeOutline.Events = { | 105 WebInspector.ElementsTreeOutline.Events = { |
| 106 SelectedNodeChanged: Symbol("SelectedNodeChanged"), | 106 SelectedNodeChanged: Symbol("SelectedNodeChanged"), |
| 107 ElementsTreeUpdated: Symbol("ElementsTreeUpdated") | 107 ElementsTreeUpdated: Symbol("ElementsTreeUpdated") |
| 108 } | 108 }; |
| 109 | 109 |
| 110 /** | 110 /** |
| 111 * @const | 111 * @const |
| 112 * @type {!Object.<string, string>} | 112 * @type {!Object.<string, string>} |
| 113 */ | 113 */ |
| 114 WebInspector.ElementsTreeOutline.MappedCharToEntity = { | 114 WebInspector.ElementsTreeOutline.MappedCharToEntity = { |
| 115 "\u00a0": "nbsp", | 115 "\u00a0": "nbsp", |
| 116 "\u0093": "#147", // <control> | 116 "\u0093": "#147", // <control> |
| 117 "\u00ad": "shy", | 117 "\u00ad": "shy", |
| 118 "\u2002": "ensp", | 118 "\u2002": "ensp", |
| 119 "\u2003": "emsp", | 119 "\u2003": "emsp", |
| 120 "\u2009": "thinsp", | 120 "\u2009": "thinsp", |
| 121 "\u200a": "#8202", // Hairspace | 121 "\u200a": "#8202", // Hairspace |
| 122 "\u200b": "#8203", // ZWSP | 122 "\u200b": "#8203", // ZWSP |
| 123 "\u200c": "zwnj", | 123 "\u200c": "zwnj", |
| 124 "\u200d": "zwj", | 124 "\u200d": "zwj", |
| 125 "\u200e": "lrm", | 125 "\u200e": "lrm", |
| 126 "\u200f": "rlm", | 126 "\u200f": "rlm", |
| 127 "\u202a": "#8234", // LRE | 127 "\u202a": "#8234", // LRE |
| 128 "\u202b": "#8235", // RLE | 128 "\u202b": "#8235", // RLE |
| 129 "\u202c": "#8236", // PDF | 129 "\u202c": "#8236", // PDF |
| 130 "\u202d": "#8237", // LRO | 130 "\u202d": "#8237", // LRO |
| 131 "\u202e": "#8238", // RLO | 131 "\u202e": "#8238", // RLO |
| 132 "\ufeff": "#65279" // BOM | 132 "\ufeff": "#65279" // BOM |
| 133 } | 133 }; |
| 134 | 134 |
| 135 WebInspector.ElementsTreeOutline.prototype = { | 135 WebInspector.ElementsTreeOutline.prototype = { |
| 136 _onShowHTMLCommentsChange: function() | 136 _onShowHTMLCommentsChange: function() |
| 137 { | 137 { |
| 138 var selectedNode = this.selectedDOMNode(); | 138 var selectedNode = this.selectedDOMNode(); |
| 139 if (selectedNode && selectedNode.nodeType() === Node.COMMENT_NODE && !th
is._showHTMLCommentsSetting.get()) | 139 if (selectedNode && selectedNode.nodeType() === Node.COMMENT_NODE && !th
is._showHTMLCommentsSetting.get()) |
| 140 this.selectDOMNode(selectedNode.parentNode); | 140 this.selectDOMNode(selectedNode.parentNode); |
| 141 this.update(); | 141 this.update(); |
| 142 }, | 142 }, |
| 143 | 143 |
| (...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1555 */ | 1555 */ |
| 1556 _markersChanged: function(event) | 1556 _markersChanged: function(event) |
| 1557 { | 1557 { |
| 1558 var node = /** @type {!WebInspector.DOMNode} */ (event.data); | 1558 var node = /** @type {!WebInspector.DOMNode} */ (event.data); |
| 1559 var treeElement = node[this._treeElementSymbol]; | 1559 var treeElement = node[this._treeElementSymbol]; |
| 1560 if (treeElement) | 1560 if (treeElement) |
| 1561 treeElement.updateDecorations(); | 1561 treeElement.updateDecorations(); |
| 1562 }, | 1562 }, |
| 1563 | 1563 |
| 1564 __proto__: TreeOutline.prototype | 1564 __proto__: TreeOutline.prototype |
| 1565 } | 1565 }; |
| 1566 | 1566 |
| 1567 /** | 1567 /** |
| 1568 * @constructor | 1568 * @constructor |
| 1569 */ | 1569 */ |
| 1570 WebInspector.ElementsTreeOutline.UpdateRecord = function() | 1570 WebInspector.ElementsTreeOutline.UpdateRecord = function() |
| 1571 { | 1571 { |
| 1572 } | 1572 }; |
| 1573 | 1573 |
| 1574 WebInspector.ElementsTreeOutline.UpdateRecord.prototype = { | 1574 WebInspector.ElementsTreeOutline.UpdateRecord.prototype = { |
| 1575 /** | 1575 /** |
| 1576 * @param {string} attrName | 1576 * @param {string} attrName |
| 1577 */ | 1577 */ |
| 1578 attributeModified: function(attrName) | 1578 attributeModified: function(attrName) |
| 1579 { | 1579 { |
| 1580 if (this._removedAttributes && this._removedAttributes.has(attrName)) | 1580 if (this._removedAttributes && this._removedAttributes.has(attrName)) |
| 1581 this._removedAttributes.delete(attrName); | 1581 this._removedAttributes.delete(attrName); |
| 1582 if (!this._modifiedAttributes) | 1582 if (!this._modifiedAttributes) |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1653 return !!this._hasChangedChildren; | 1653 return !!this._hasChangedChildren; |
| 1654 }, | 1654 }, |
| 1655 | 1655 |
| 1656 /** | 1656 /** |
| 1657 * @return {boolean} | 1657 * @return {boolean} |
| 1658 */ | 1658 */ |
| 1659 hasRemovedChildren: function() | 1659 hasRemovedChildren: function() |
| 1660 { | 1660 { |
| 1661 return !!this._hasRemovedChildren; | 1661 return !!this._hasRemovedChildren; |
| 1662 } | 1662 } |
| 1663 } | 1663 }; |
| 1664 | 1664 |
| 1665 /** | 1665 /** |
| 1666 * @constructor | 1666 * @constructor |
| 1667 * @implements {WebInspector.Renderer} | 1667 * @implements {WebInspector.Renderer} |
| 1668 */ | 1668 */ |
| 1669 WebInspector.ElementsTreeOutline.Renderer = function() | 1669 WebInspector.ElementsTreeOutline.Renderer = function() |
| 1670 { | 1670 { |
| 1671 } | 1671 }; |
| 1672 | 1672 |
| 1673 WebInspector.ElementsTreeOutline.Renderer.prototype = { | 1673 WebInspector.ElementsTreeOutline.Renderer.prototype = { |
| 1674 /** | 1674 /** |
| 1675 * @override | 1675 * @override |
| 1676 * @param {!Object} object | 1676 * @param {!Object} object |
| 1677 * @return {!Promise.<!Element>} | 1677 * @return {!Promise.<!Element>} |
| 1678 */ | 1678 */ |
| 1679 render: function(object) | 1679 render: function(object) |
| 1680 { | 1680 { |
| 1681 return new Promise(renderPromise); | 1681 return new Promise(renderPromise); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1712 var treeOutline = new WebInspector.ElementsTreeOutline(node.domM
odel(), false, false); | 1712 var treeOutline = new WebInspector.ElementsTreeOutline(node.domM
odel(), false, false); |
| 1713 treeOutline.rootDOMNode = node; | 1713 treeOutline.rootDOMNode = node; |
| 1714 if (!treeOutline.firstChild().isExpandable()) | 1714 if (!treeOutline.firstChild().isExpandable()) |
| 1715 treeOutline._element.classList.add("single-node"); | 1715 treeOutline._element.classList.add("single-node"); |
| 1716 treeOutline.setVisible(true); | 1716 treeOutline.setVisible(true); |
| 1717 treeOutline.element.treeElementForTest = treeOutline.firstChild(
); | 1717 treeOutline.element.treeElementForTest = treeOutline.firstChild(
); |
| 1718 resolve(treeOutline.element); | 1718 resolve(treeOutline.element); |
| 1719 } | 1719 } |
| 1720 } | 1720 } |
| 1721 } | 1721 } |
| 1722 } | 1722 }; |
| 1723 | 1723 |
| 1724 /** | 1724 /** |
| 1725 * @constructor | 1725 * @constructor |
| 1726 * @extends {TreeElement} | 1726 * @extends {TreeElement} |
| 1727 * @param {!WebInspector.DOMNodeShortcut} nodeShortcut | 1727 * @param {!WebInspector.DOMNodeShortcut} nodeShortcut |
| 1728 */ | 1728 */ |
| 1729 WebInspector.ElementsTreeOutline.ShortcutTreeElement = function(nodeShortcut) | 1729 WebInspector.ElementsTreeOutline.ShortcutTreeElement = function(nodeShortcut) |
| 1730 { | 1730 { |
| 1731 TreeElement.call(this, ""); | 1731 TreeElement.call(this, ""); |
| 1732 this.listItemElement.createChild("div", "selection fill"); | 1732 this.listItemElement.createChild("div", "selection fill"); |
| 1733 var title = this.listItemElement.createChild("span", "elements-tree-shortcut
-title"); | 1733 var title = this.listItemElement.createChild("span", "elements-tree-shortcut
-title"); |
| 1734 var text = nodeShortcut.nodeName.toLowerCase(); | 1734 var text = nodeShortcut.nodeName.toLowerCase(); |
| 1735 if (nodeShortcut.nodeType === Node.ELEMENT_NODE) | 1735 if (nodeShortcut.nodeType === Node.ELEMENT_NODE) |
| 1736 text = "<" + text + ">"; | 1736 text = "<" + text + ">"; |
| 1737 title.textContent = "\u21AA " + text; | 1737 title.textContent = "\u21AA " + text; |
| 1738 | 1738 |
| 1739 var link = WebInspector.DOMPresentationUtils.linkifyDeferredNodeReference(no
deShortcut.deferredNode); | 1739 var link = WebInspector.DOMPresentationUtils.linkifyDeferredNodeReference(no
deShortcut.deferredNode); |
| 1740 this.listItemElement.createTextChild(" "); | 1740 this.listItemElement.createTextChild(" "); |
| 1741 link.classList.add("elements-tree-shortcut-link"); | 1741 link.classList.add("elements-tree-shortcut-link"); |
| 1742 link.textContent = WebInspector.UIString("reveal"); | 1742 link.textContent = WebInspector.UIString("reveal"); |
| 1743 this.listItemElement.appendChild(link); | 1743 this.listItemElement.appendChild(link); |
| 1744 this._nodeShortcut = nodeShortcut; | 1744 this._nodeShortcut = nodeShortcut; |
| 1745 } | 1745 }; |
| 1746 | 1746 |
| 1747 WebInspector.ElementsTreeOutline.ShortcutTreeElement.prototype = { | 1747 WebInspector.ElementsTreeOutline.ShortcutTreeElement.prototype = { |
| 1748 /** | 1748 /** |
| 1749 * @return {boolean} | 1749 * @return {boolean} |
| 1750 */ | 1750 */ |
| 1751 get hovered() | 1751 get hovered() |
| 1752 { | 1752 { |
| 1753 return this._hovered; | 1753 return this._hovered; |
| 1754 }, | 1754 }, |
| 1755 | 1755 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1788 { | 1788 { |
| 1789 if (node) { | 1789 if (node) { |
| 1790 this.treeOutline._selectedDOMNode = node; | 1790 this.treeOutline._selectedDOMNode = node; |
| 1791 this.treeOutline._selectedNodeChanged(); | 1791 this.treeOutline._selectedNodeChanged(); |
| 1792 } | 1792 } |
| 1793 } | 1793 } |
| 1794 return true; | 1794 return true; |
| 1795 }, | 1795 }, |
| 1796 | 1796 |
| 1797 __proto__: TreeElement.prototype | 1797 __proto__: TreeElement.prototype |
| 1798 } | 1798 }; |
| OLD | NEW |