Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/DOMModel.js

Issue 2826833002: Revert of [DevTools] Consolidate overlay-related functionality in Overlay domain (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2009 Joseph Pecoraro 3 * Copyright (C) 2009 Joseph Pecoraro
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 return Common.ParsedURL.completeURL(frameOwnerCandidate.baseURL, url); 833 return Common.ParsedURL.completeURL(frameOwnerCandidate.baseURL, url);
834 } 834 }
835 return null; 835 return null;
836 } 836 }
837 837
838 /** 838 /**
839 * @param {string=} mode 839 * @param {string=} mode
840 * @param {!Protocol.Runtime.RemoteObjectId=} objectId 840 * @param {!Protocol.Runtime.RemoteObjectId=} objectId
841 */ 841 */
842 highlight(mode, objectId) { 842 highlight(mode, objectId) {
843 this._domModel.overlayModel().highlightDOMNode(this.id, mode, undefined, obj ectId); 843 this._domModel.highlightDOMNode(this.id, mode, undefined, objectId);
844 } 844 }
845 845
846 highlightForTwoSeconds() { 846 highlightForTwoSeconds() {
847 this._domModel.overlayModel().highlightDOMNodeForTwoSeconds(this.id); 847 this._domModel.highlightDOMNodeForTwoSeconds(this.id);
848 } 848 }
849 849
850 /** 850 /**
851 * @param {string=} objectGroup 851 * @param {string=} objectGroup
852 * @param {function(?SDK.RemoteObject)=} callback 852 * @param {function(?SDK.RemoteObject)=} callback
853 */ 853 */
854 resolveToObject(objectGroup, callback) { 854 resolveToObject(objectGroup, callback) {
855 this._agent.resolveNode(this.id, objectGroup, mycallback.bind(this)); 855 this._agent.resolveNode(this.id, objectGroup, mycallback.bind(this));
856 856
857 /** 857 /**
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 1004
1005 /** 1005 /**
1006 * @return {number} 1006 * @return {number}
1007 */ 1007 */
1008 backendNodeId() { 1008 backendNodeId() {
1009 return this._backendNodeId; 1009 return this._backendNodeId;
1010 } 1010 }
1011 1011
1012 highlight() { 1012 highlight() {
1013 if (this._domModel) 1013 if (this._domModel)
1014 this._domModel.overlayModel().highlightDOMNode(undefined, undefined, this. _backendNodeId); 1014 this._domModel.highlightDOMNode(undefined, undefined, this._backendNodeId) ;
1015 } 1015 }
1016 }; 1016 };
1017 1017
1018 /** 1018 /**
1019 * @unrestricted 1019 * @unrestricted
1020 */ 1020 */
1021 SDK.DOMNodeShortcut = class { 1021 SDK.DOMNodeShortcut = class {
1022 /** 1022 /**
1023 * @param {!SDK.Target} target 1023 * @param {!SDK.Target} target
1024 * @param {number} backendNodeId 1024 * @param {number} backendNodeId
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 this._agent = target.domAgent(); 1061 this._agent = target.domAgent();
1062 1062
1063 /** @type {!Object.<number, !SDK.DOMNode>} */ 1063 /** @type {!Object.<number, !SDK.DOMNode>} */
1064 this._idToDOMNode = {}; 1064 this._idToDOMNode = {};
1065 /** @type {?SDK.DOMDocument} */ 1065 /** @type {?SDK.DOMDocument} */
1066 this._document = null; 1066 this._document = null;
1067 /** @type {!Object.<number, boolean>} */ 1067 /** @type {!Object.<number, boolean>} */
1068 this._attributeLoadNodeIds = {}; 1068 this._attributeLoadNodeIds = {};
1069 target.registerDOMDispatcher(new SDK.DOMDispatcher(this)); 1069 target.registerDOMDispatcher(new SDK.DOMDispatcher(this));
1070 1070
1071 this._inspectModeEnabled = false;
1071 this._runtimeModel = /** @type {!SDK.RuntimeModel} */ (target.model(SDK.Runt imeModel)); 1072 this._runtimeModel = /** @type {!SDK.RuntimeModel} */ (target.model(SDK.Runt imeModel));
1072 1073
1074 this._defaultHighlighter = new SDK.DefaultDOMNodeHighlighter(this._agent);
1075 this._highlighter = this._defaultHighlighter;
1076
1073 this._agent.enable(); 1077 this._agent.enable();
1074 } 1078 }
1075 1079
1076 /** 1080 /**
1077 * @return {!SDK.RuntimeModel} 1081 * @return {!SDK.RuntimeModel}
1078 */ 1082 */
1079 runtimeModel() { 1083 runtimeModel() {
1080 return this._runtimeModel; 1084 return this._runtimeModel;
1081 } 1085 }
1082 1086
1083 /** 1087 /**
1084 * @return {!SDK.CSSModel} 1088 * @return {!SDK.CSSModel}
1085 */ 1089 */
1086 cssModel() { 1090 cssModel() {
1087 return /** @type {!SDK.CSSModel} */ (this.target().model(SDK.CSSModel)); 1091 return /** @type {!SDK.CSSModel} */ (this.target().model(SDK.CSSModel));
1088 } 1092 }
1089 1093
1090 /** 1094 /**
1091 * @return {!SDK.OverlayModel} 1095 * @param {!SDK.RemoteObject} object
1092 */ 1096 */
1093 overlayModel() { 1097 static highlightObjectAsDOMNode(object) {
1094 return /** @type {!SDK.OverlayModel} */ (this.target().model(SDK.OverlayMode l)); 1098 var domModel = object.runtimeModel().target().model(SDK.DOMModel);
1099 if (domModel)
1100 domModel.highlightDOMNode(undefined, undefined, undefined, object.objectId );
1101 }
1102
1103 static hideDOMNodeHighlight() {
1104 for (var domModel of SDK.targetManager.models(SDK.DOMModel))
1105 domModel.highlightDOMNode(0);
1106 }
1107
1108 static muteHighlight() {
1109 SDK.DOMModel.hideDOMNodeHighlight();
1110 SDK.DOMModel._highlightDisabled = true;
1111 }
1112
1113 static unmuteHighlight() {
1114 SDK.DOMModel._highlightDisabled = false;
1095 } 1115 }
1096 1116
1097 static cancelSearch() { 1117 static cancelSearch() {
1098 for (var domModel of SDK.targetManager.models(SDK.DOMModel)) 1118 for (var domModel of SDK.targetManager.models(SDK.DOMModel))
1099 domModel._cancelSearch(); 1119 domModel._cancelSearch();
1100 } 1120 }
1101 1121
1102 /** 1122 /**
1103 * @param {!SDK.DOMNode} node 1123 * @param {!SDK.DOMNode} node
1104 */ 1124 */
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 for (var i = 0; i < node._shadowRoots.length; ++i) 1534 for (var i = 0; i < node._shadowRoots.length; ++i)
1515 this._unbind(node._shadowRoots[i]); 1535 this._unbind(node._shadowRoots[i]);
1516 var pseudoElements = node.pseudoElements(); 1536 var pseudoElements = node.pseudoElements();
1517 for (var value of pseudoElements.values()) 1537 for (var value of pseudoElements.values())
1518 this._unbind(value); 1538 this._unbind(value);
1519 if (node._templateContent) 1539 if (node._templateContent)
1520 this._unbind(node._templateContent); 1540 this._unbind(node._templateContent);
1521 } 1541 }
1522 1542
1523 /** 1543 /**
1544 * @param {!Protocol.DOM.BackendNodeId} backendNodeId
1545 */
1546 _inspectNodeRequested(backendNodeId) {
1547 var deferredNode = new SDK.DeferredDOMNode(this.target(), backendNodeId);
1548 this.dispatchEventToListeners(SDK.DOMModel.Events.NodeInspected, deferredNod e);
1549 }
1550
1551 /**
1524 * @param {string} query 1552 * @param {string} query
1525 * @param {boolean} includeUserAgentShadowDOM 1553 * @param {boolean} includeUserAgentShadowDOM
1526 * @param {function(number)} searchCallback 1554 * @param {function(number)} searchCallback
1527 */ 1555 */
1528 performSearch(query, includeUserAgentShadowDOM, searchCallback) { 1556 performSearch(query, includeUserAgentShadowDOM, searchCallback) {
1529 SDK.DOMModel.cancelSearch(); 1557 SDK.DOMModel.cancelSearch();
1530 1558
1531 /** 1559 /**
1532 * @param {?Protocol.Error} error 1560 * @param {?Protocol.Error} error
1533 * @param {string} searchId 1561 * @param {string} searchId
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 /** 1672 /**
1645 * @param {!Protocol.DOM.NodeId} nodeId 1673 * @param {!Protocol.DOM.NodeId} nodeId
1646 * @param {string} selectors 1674 * @param {string} selectors
1647 * @param {function(!Array.<!Protocol.DOM.NodeId>=)=} callback 1675 * @param {function(!Array.<!Protocol.DOM.NodeId>=)=} callback
1648 */ 1676 */
1649 querySelectorAll(nodeId, selectors, callback) { 1677 querySelectorAll(nodeId, selectors, callback) {
1650 this._agent.querySelectorAll(nodeId, selectors, this._wrapClientCallback(cal lback)); 1678 this._agent.querySelectorAll(nodeId, selectors, this._wrapClientCallback(cal lback));
1651 } 1679 }
1652 1680
1653 /** 1681 /**
1682 * @param {!Protocol.DOM.NodeId=} nodeId
1683 * @param {string=} mode
1684 * @param {!Protocol.DOM.BackendNodeId=} backendNodeId
1685 * @param {!Protocol.Runtime.RemoteObjectId=} objectId
1686 */
1687 highlightDOMNode(nodeId, mode, backendNodeId, objectId) {
1688 this.highlightDOMNodeWithConfig(nodeId, {mode: mode}, backendNodeId, objectI d);
1689 }
1690
1691 /**
1692 * @param {!Protocol.DOM.NodeId=} nodeId
1693 * @param {!{mode: (string|undefined), showInfo: (boolean|undefined), selector s: (string|undefined)}=} config
1694 * @param {!Protocol.DOM.BackendNodeId=} backendNodeId
1695 * @param {!Protocol.Runtime.RemoteObjectId=} objectId
1696 */
1697 highlightDOMNodeWithConfig(nodeId, config, backendNodeId, objectId) {
1698 if (SDK.DOMModel._highlightDisabled)
1699 return;
1700 config = config || {mode: 'all', showInfo: undefined, selectors: undefined};
1701 if (this._hideDOMNodeHighlightTimeout) {
1702 clearTimeout(this._hideDOMNodeHighlightTimeout);
1703 delete this._hideDOMNodeHighlightTimeout;
1704 }
1705 var highlightConfig = this._buildHighlightConfig(config.mode);
1706 if (typeof config.showInfo !== 'undefined')
1707 highlightConfig.showInfo = config.showInfo;
1708 if (typeof config.selectors !== 'undefined')
1709 highlightConfig.selectorList = config.selectors;
1710 this._highlighter.highlightDOMNode(this.nodeForId(nodeId || 0), highlightCon fig, backendNodeId, objectId);
1711 }
1712
1713 /**
1714 * @param {!Protocol.DOM.NodeId} nodeId
1715 */
1716 highlightDOMNodeForTwoSeconds(nodeId) {
1717 this.highlightDOMNode(nodeId);
1718 this._hideDOMNodeHighlightTimeout = setTimeout(SDK.DOMModel.hideDOMNodeHighl ight.bind(SDK.DOMModel), 2000);
1719 }
1720
1721 /**
1722 * @param {!Protocol.Page.FrameId} frameId
1723 */
1724 highlightFrame(frameId) {
1725 if (SDK.DOMModel._highlightDisabled)
1726 return;
1727 this._highlighter.highlightFrame(frameId);
1728 }
1729
1730 /**
1731 * @param {!Protocol.DOM.InspectMode} mode
1732 * @param {function(?Protocol.Error)=} callback
1733 */
1734 setInspectMode(mode, callback) {
1735 /**
1736 * @this {SDK.DOMModel}
1737 */
1738 function onDocumentAvailable() {
1739 this._inspectModeEnabled = mode !== Protocol.DOM.InspectMode.None;
1740 this.dispatchEventToListeners(SDK.DOMModel.Events.InspectModeWillBeToggled , this);
1741 this._highlighter.setInspectMode(mode, this._buildHighlightConfig(), callb ack);
1742 }
1743 this.requestDocument(onDocumentAvailable.bind(this));
1744 }
1745
1746 /**
1747 * @return {boolean}
1748 */
1749 inspectModeEnabled() {
1750 return this._inspectModeEnabled;
1751 }
1752
1753 /**
1754 * @param {string=} mode
1755 * @return {!Protocol.DOM.HighlightConfig}
1756 */
1757 _buildHighlightConfig(mode) {
1758 mode = mode || 'all';
1759 var showRulers = Common.moduleSetting('showMetricsRulers').get();
1760 var highlightConfig = {showInfo: mode === 'all', showRulers: showRulers, sho wExtensionLines: showRulers};
1761 if (mode === 'all' || mode === 'content')
1762 highlightConfig.contentColor = Common.Color.PageHighlight.Content.toProtoc olRGBA();
1763
1764 if (mode === 'all' || mode === 'padding')
1765 highlightConfig.paddingColor = Common.Color.PageHighlight.Padding.toProtoc olRGBA();
1766
1767 if (mode === 'all' || mode === 'border')
1768 highlightConfig.borderColor = Common.Color.PageHighlight.Border.toProtocol RGBA();
1769
1770 if (mode === 'all' || mode === 'margin')
1771 highlightConfig.marginColor = Common.Color.PageHighlight.Margin.toProtocol RGBA();
1772
1773 if (mode === 'all') {
1774 highlightConfig.eventTargetColor = Common.Color.PageHighlight.EventTarget. toProtocolRGBA();
1775 highlightConfig.shapeColor = Common.Color.PageHighlight.Shape.toProtocolRG BA();
1776 highlightConfig.shapeMarginColor = Common.Color.PageHighlight.ShapeMargin. toProtocolRGBA();
1777 highlightConfig.displayAsMaterial = true;
1778 }
1779 return highlightConfig;
1780 }
1781
1782 /**
1654 * @param {!SDK.DOMNode} node 1783 * @param {!SDK.DOMNode} node
1655 * @param {function(?Protocol.Error, ...)=} callback 1784 * @param {function(?Protocol.Error, ...)=} callback
1656 * @return {function(...)} 1785 * @return {function(...)}
1657 * @template T 1786 * @template T
1658 */ 1787 */
1659 _markRevision(node, callback) { 1788 _markRevision(node, callback) {
1660 /** 1789 /**
1661 * @param {?Protocol.Error} error 1790 * @param {?Protocol.Error} error
1662 * @this {SDK.DOMModel} 1791 * @this {SDK.DOMModel}
1663 */ 1792 */
(...skipping 19 matching lines...) Expand all
1683 } 1812 }
1684 1813
1685 /** 1814 /**
1686 * @param {function(?Protocol.Error)=} callback 1815 * @param {function(?Protocol.Error)=} callback
1687 */ 1816 */
1688 redo(callback) { 1817 redo(callback) {
1689 this._agent.redo(callback); 1818 this._agent.redo(callback);
1690 } 1819 }
1691 1820
1692 /** 1821 /**
1822 * @param {?SDK.DOMNodeHighlighter} highlighter
1823 */
1824 setHighlighter(highlighter) {
1825 this._highlighter = highlighter || this._defaultHighlighter;
1826 }
1827
1828 /**
1693 * @param {number} x 1829 * @param {number} x
1694 * @param {number} y 1830 * @param {number} y
1695 * @param {boolean} includeUserAgentShadowDOM 1831 * @param {boolean} includeUserAgentShadowDOM
1696 * @param {function(?SDK.DOMNode)} callback 1832 * @param {function(?SDK.DOMNode)} callback
1697 */ 1833 */
1698 nodeForLocation(x, y, includeUserAgentShadowDOM, callback) { 1834 nodeForLocation(x, y, includeUserAgentShadowDOM, callback) {
1699 this._agent.getNodeForLocation(x, y, includeUserAgentShadowDOM, mycallback.b ind(this)); 1835 this._agent.getNodeForLocation(x, y, includeUserAgentShadowDOM, mycallback.b ind(this));
1700 1836
1701 /** 1837 /**
1702 * @param {?Protocol.Error} error 1838 * @param {?Protocol.Error} error
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 return new Promise(promiseBody.bind(this)); 1893 return new Promise(promiseBody.bind(this));
1758 1894
1759 /** 1895 /**
1760 * @param {function()} fulfill 1896 * @param {function()} fulfill
1761 * @this {SDK.DOMModel} 1897 * @this {SDK.DOMModel}
1762 */ 1898 */
1763 function promiseBody(fulfill) { 1899 function promiseBody(fulfill) {
1764 this._agent.enable(fulfill); 1900 this._agent.enable(fulfill);
1765 } 1901 }
1766 } 1902 }
1903
1904 /**
1905 * @param {!Protocol.DOM.NodeId} nodeId
1906 */
1907 nodeHighlightRequested(nodeId) {
1908 var node = this.nodeForId(nodeId);
1909 if (!node)
1910 return;
1911
1912 this.dispatchEventToListeners(SDK.DOMModel.Events.NodeHighlightedInOverlay, node);
1913 }
1767 }; 1914 };
1768 1915
1769 SDK.SDKModel.register(SDK.DOMModel, SDK.Target.Capability.DOM, true); 1916 SDK.SDKModel.register(SDK.DOMModel, SDK.Target.Capability.DOM, true);
1770 1917
1771 /** @enum {symbol} */ 1918 /** @enum {symbol} */
1772 SDK.DOMModel.Events = { 1919 SDK.DOMModel.Events = {
1773 AttrModified: Symbol('AttrModified'), 1920 AttrModified: Symbol('AttrModified'),
1774 AttrRemoved: Symbol('AttrRemoved'), 1921 AttrRemoved: Symbol('AttrRemoved'),
1775 CharacterDataModified: Symbol('CharacterDataModified'), 1922 CharacterDataModified: Symbol('CharacterDataModified'),
1776 DOMMutated: Symbol('DOMMutated'), 1923 DOMMutated: Symbol('DOMMutated'),
1777 NodeInserted: Symbol('NodeInserted'), 1924 NodeInserted: Symbol('NodeInserted'),
1925 NodeInspected: Symbol('NodeInspected'),
1926 NodeHighlightedInOverlay: Symbol('NodeHighlightedInOverlay'),
1778 NodeRemoved: Symbol('NodeRemoved'), 1927 NodeRemoved: Symbol('NodeRemoved'),
1779 DocumentUpdated: Symbol('DocumentUpdated'), 1928 DocumentUpdated: Symbol('DocumentUpdated'),
1780 ChildNodeCountUpdated: Symbol('ChildNodeCountUpdated'), 1929 ChildNodeCountUpdated: Symbol('ChildNodeCountUpdated'),
1781 DistributedNodesChanged: Symbol('DistributedNodesChanged'), 1930 DistributedNodesChanged: Symbol('DistributedNodesChanged'),
1931 InspectModeWillBeToggled: Symbol('InspectModeWillBeToggled'),
1782 MarkersChanged: Symbol('MarkersChanged') 1932 MarkersChanged: Symbol('MarkersChanged')
1783 }; 1933 };
1784 1934
1785 1935
1786 /** 1936 /**
1787 * @implements {Protocol.DOMDispatcher} 1937 * @implements {Protocol.DOMDispatcher}
1788 * @unrestricted 1938 * @unrestricted
1789 */ 1939 */
1790 SDK.DOMDispatcher = class { 1940 SDK.DOMDispatcher = class {
1791 /** 1941 /**
1792 * @param {!SDK.DOMModel} domModel 1942 * @param {!SDK.DOMModel} domModel
1793 */ 1943 */
1794 constructor(domModel) { 1944 constructor(domModel) {
1795 this._domModel = domModel; 1945 this._domModel = domModel;
1796 } 1946 }
1797 1947
1798 /** 1948 /**
1799 * @override 1949 * @override
1800 */ 1950 */
1801 documentUpdated() { 1951 documentUpdated() {
1802 this._domModel._documentUpdated(); 1952 this._domModel._documentUpdated();
1803 } 1953 }
1804 1954
1805 /** 1955 /**
1806 * @override 1956 * @override
1807 * @param {!Protocol.DOM.NodeId} nodeId 1957 * @param {!Protocol.DOM.NodeId} nodeId
1958 */
1959 inspectNodeRequested(nodeId) {
1960 this._domModel._inspectNodeRequested(nodeId);
1961 }
1962
1963 /**
1964 * @override
1965 * @param {!Protocol.DOM.NodeId} nodeId
1808 * @param {string} name 1966 * @param {string} name
1809 * @param {string} value 1967 * @param {string} value
1810 */ 1968 */
1811 attributeModified(nodeId, name, value) { 1969 attributeModified(nodeId, name, value) {
1812 this._domModel._attributeModified(nodeId, name, value); 1970 this._domModel._attributeModified(nodeId, name, value);
1813 } 1971 }
1814 1972
1815 /** 1973 /**
1816 * @override 1974 * @override
1817 * @param {!Protocol.DOM.NodeId} nodeId 1975 * @param {!Protocol.DOM.NodeId} nodeId
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1912 } 2070 }
1913 2071
1914 /** 2072 /**
1915 * @override 2073 * @override
1916 * @param {!Protocol.DOM.NodeId} insertionPointId 2074 * @param {!Protocol.DOM.NodeId} insertionPointId
1917 * @param {!Array.<!Protocol.DOM.BackendNode>} distributedNodes 2075 * @param {!Array.<!Protocol.DOM.BackendNode>} distributedNodes
1918 */ 2076 */
1919 distributedNodesUpdated(insertionPointId, distributedNodes) { 2077 distributedNodesUpdated(insertionPointId, distributedNodes) {
1920 this._domModel._distributedNodesUpdated(insertionPointId, distributedNodes); 2078 this._domModel._distributedNodesUpdated(insertionPointId, distributedNodes);
1921 } 2079 }
2080
2081 /**
2082 * @override
2083 * @param {!Protocol.DOM.NodeId} nodeId
2084 */
2085 nodeHighlightRequested(nodeId) {
2086 this._domModel.nodeHighlightRequested(nodeId);
2087 }
1922 }; 2088 };
2089
2090 /**
2091 * @interface
2092 */
2093 SDK.DOMNodeHighlighter = function() {};
2094
2095 SDK.DOMNodeHighlighter.prototype = {
2096 /**
2097 * @param {?SDK.DOMNode} node
2098 * @param {!Protocol.DOM.HighlightConfig} config
2099 * @param {!Protocol.DOM.BackendNodeId=} backendNodeId
2100 * @param {!Protocol.Runtime.RemoteObjectId=} objectId
2101 */
2102 highlightDOMNode(node, config, backendNodeId, objectId) {},
2103
2104 /**
2105 * @param {!Protocol.DOM.InspectMode} mode
2106 * @param {!Protocol.DOM.HighlightConfig} config
2107 * @param {function(?Protocol.Error)=} callback
2108 */
2109 setInspectMode(mode, config, callback) {},
2110
2111 /**
2112 * @param {!Protocol.Page.FrameId} frameId
2113 */
2114 highlightFrame(frameId) {}
2115 };
2116
2117 /**
2118 * @implements {SDK.DOMNodeHighlighter}
2119 * @unrestricted
2120 */
2121 SDK.DefaultDOMNodeHighlighter = class {
2122 /**
2123 * @param {!Protocol.DOMAgent} agent
2124 */
2125 constructor(agent) {
2126 this._agent = agent;
2127 }
2128
2129 /**
2130 * @override
2131 * @param {?SDK.DOMNode} node
2132 * @param {!Protocol.DOM.HighlightConfig} config
2133 * @param {!Protocol.DOM.BackendNodeId=} backendNodeId
2134 * @param {!Protocol.Runtime.RemoteObjectId=} objectId
2135 */
2136 highlightDOMNode(node, config, backendNodeId, objectId) {
2137 if (objectId || node || backendNodeId)
2138 this._agent.highlightNode(config, (objectId || backendNodeId) ? undefined : node.id, backendNodeId, objectId);
2139 else
2140 this._agent.hideHighlight();
2141 }
2142
2143 /**
2144 * @override
2145 * @param {!Protocol.DOM.InspectMode} mode
2146 * @param {!Protocol.DOM.HighlightConfig} config
2147 * @param {function(?Protocol.Error)=} callback
2148 */
2149 setInspectMode(mode, config, callback) {
2150 this._agent.setInspectMode(mode, config, callback);
2151 }
2152
2153 /**
2154 * @override
2155 * @param {!Protocol.Page.FrameId} frameId
2156 */
2157 highlightFrame(frameId) {
2158 this._agent.highlightFrame(
2159 frameId, Common.Color.PageHighlight.Content.toProtocolRGBA(),
2160 Common.Color.PageHighlight.ContentOutline.toProtocolRGBA());
2161 }
2162 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698