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

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

Issue 2835843002: 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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 for (var i = 0; i < node._shadowRoots.length; ++i) 1532 for (var i = 0; i < node._shadowRoots.length; ++i)
1513 this._unbind(node._shadowRoots[i]); 1533 this._unbind(node._shadowRoots[i]);
1514 var pseudoElements = node.pseudoElements(); 1534 var pseudoElements = node.pseudoElements();
1515 for (var value of pseudoElements.values()) 1535 for (var value of pseudoElements.values())
1516 this._unbind(value); 1536 this._unbind(value);
1517 if (node._templateContent) 1537 if (node._templateContent)
1518 this._unbind(node._templateContent); 1538 this._unbind(node._templateContent);
1519 } 1539 }
1520 1540
1521 /** 1541 /**
1542 * @param {!Protocol.DOM.BackendNodeId} backendNodeId
1543 */
1544 _inspectNodeRequested(backendNodeId) {
1545 var deferredNode = new SDK.DeferredDOMNode(this.target(), backendNodeId);
1546 this.dispatchEventToListeners(SDK.DOMModel.Events.NodeInspected, deferredNod e);
1547 }
1548
1549 /**
1522 * @param {string} query 1550 * @param {string} query
1523 * @param {boolean} includeUserAgentShadowDOM 1551 * @param {boolean} includeUserAgentShadowDOM
1524 * @param {function(number)} searchCallback 1552 * @param {function(number)} searchCallback
1525 */ 1553 */
1526 performSearch(query, includeUserAgentShadowDOM, searchCallback) { 1554 performSearch(query, includeUserAgentShadowDOM, searchCallback) {
1527 SDK.DOMModel.cancelSearch(); 1555 SDK.DOMModel.cancelSearch();
1528 1556
1529 /** 1557 /**
1530 * @param {?Protocol.Error} error 1558 * @param {?Protocol.Error} error
1531 * @param {string} searchId 1559 * @param {string} searchId
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 /** 1670 /**
1643 * @param {!Protocol.DOM.NodeId} nodeId 1671 * @param {!Protocol.DOM.NodeId} nodeId
1644 * @param {string} selectors 1672 * @param {string} selectors
1645 * @param {function(?Array<!Protocol.DOM.NodeId>)} callback 1673 * @param {function(?Array<!Protocol.DOM.NodeId>)} callback
1646 */ 1674 */
1647 querySelectorAll(nodeId, selectors, callback) { 1675 querySelectorAll(nodeId, selectors, callback) {
1648 this._agent.querySelectorAll(nodeId, selectors, this._wrapClientCallback(cal lback)); 1676 this._agent.querySelectorAll(nodeId, selectors, this._wrapClientCallback(cal lback));
1649 } 1677 }
1650 1678
1651 /** 1679 /**
1680 * @param {!Protocol.DOM.NodeId=} nodeId
1681 * @param {string=} mode
1682 * @param {!Protocol.DOM.BackendNodeId=} backendNodeId
1683 * @param {!Protocol.Runtime.RemoteObjectId=} objectId
1684 */
1685 highlightDOMNode(nodeId, mode, backendNodeId, objectId) {
1686 this.highlightDOMNodeWithConfig(nodeId, {mode: mode}, backendNodeId, objectI d);
1687 }
1688
1689 /**
1690 * @param {!Protocol.DOM.NodeId=} nodeId
1691 * @param {!{mode: (string|undefined), showInfo: (boolean|undefined), selector s: (string|undefined)}=} config
1692 * @param {!Protocol.DOM.BackendNodeId=} backendNodeId
1693 * @param {!Protocol.Runtime.RemoteObjectId=} objectId
1694 */
1695 highlightDOMNodeWithConfig(nodeId, config, backendNodeId, objectId) {
1696 if (SDK.DOMModel._highlightDisabled)
1697 return;
1698 config = config || {mode: 'all', showInfo: undefined, selectors: undefined};
1699 if (this._hideDOMNodeHighlightTimeout) {
1700 clearTimeout(this._hideDOMNodeHighlightTimeout);
1701 delete this._hideDOMNodeHighlightTimeout;
1702 }
1703 var highlightConfig = this._buildHighlightConfig(config.mode);
1704 if (typeof config.showInfo !== 'undefined')
1705 highlightConfig.showInfo = config.showInfo;
1706 if (typeof config.selectors !== 'undefined')
1707 highlightConfig.selectorList = config.selectors;
1708 this._highlighter.highlightDOMNode(this.nodeForId(nodeId || 0), highlightCon fig, backendNodeId, objectId);
1709 }
1710
1711 /**
1712 * @param {!Protocol.DOM.NodeId} nodeId
1713 */
1714 highlightDOMNodeForTwoSeconds(nodeId) {
1715 this.highlightDOMNode(nodeId);
1716 this._hideDOMNodeHighlightTimeout = setTimeout(SDK.DOMModel.hideDOMNodeHighl ight.bind(SDK.DOMModel), 2000);
1717 }
1718
1719 /**
1720 * @param {!Protocol.Page.FrameId} frameId
1721 */
1722 highlightFrame(frameId) {
1723 if (SDK.DOMModel._highlightDisabled)
1724 return;
1725 this._highlighter.highlightFrame(frameId);
1726 }
1727
1728 /**
1729 * @param {!Protocol.DOM.InspectMode} mode
1730 * @param {function(?Protocol.Error)=} callback
1731 */
1732 setInspectMode(mode, callback) {
1733 /**
1734 * @this {SDK.DOMModel}
1735 */
1736 function onDocumentAvailable() {
1737 this._inspectModeEnabled = mode !== Protocol.DOM.InspectMode.None;
1738 this.dispatchEventToListeners(SDK.DOMModel.Events.InspectModeWillBeToggled , this);
1739 this._highlighter.setInspectMode(mode, this._buildHighlightConfig(), callb ack);
1740 }
1741 this.requestDocument(onDocumentAvailable.bind(this));
1742 }
1743
1744 /**
1745 * @return {boolean}
1746 */
1747 inspectModeEnabled() {
1748 return this._inspectModeEnabled;
1749 }
1750
1751 /**
1752 * @param {string=} mode
1753 * @return {!Protocol.DOM.HighlightConfig}
1754 */
1755 _buildHighlightConfig(mode) {
1756 mode = mode || 'all';
1757 var showRulers = Common.moduleSetting('showMetricsRulers').get();
1758 var highlightConfig = {showInfo: mode === 'all', showRulers: showRulers, sho wExtensionLines: showRulers};
1759 if (mode === 'all' || mode === 'content')
1760 highlightConfig.contentColor = Common.Color.PageHighlight.Content.toProtoc olRGBA();
1761
1762 if (mode === 'all' || mode === 'padding')
1763 highlightConfig.paddingColor = Common.Color.PageHighlight.Padding.toProtoc olRGBA();
1764
1765 if (mode === 'all' || mode === 'border')
1766 highlightConfig.borderColor = Common.Color.PageHighlight.Border.toProtocol RGBA();
1767
1768 if (mode === 'all' || mode === 'margin')
1769 highlightConfig.marginColor = Common.Color.PageHighlight.Margin.toProtocol RGBA();
1770
1771 if (mode === 'all') {
1772 highlightConfig.eventTargetColor = Common.Color.PageHighlight.EventTarget. toProtocolRGBA();
1773 highlightConfig.shapeColor = Common.Color.PageHighlight.Shape.toProtocolRG BA();
1774 highlightConfig.shapeMarginColor = Common.Color.PageHighlight.ShapeMargin. toProtocolRGBA();
1775 highlightConfig.displayAsMaterial = true;
1776 }
1777 return highlightConfig;
1778 }
1779
1780 /**
1652 * @param {!SDK.DOMNode} node 1781 * @param {!SDK.DOMNode} node
1653 * @param {function(?Protocol.Error, ...)=} callback 1782 * @param {function(?Protocol.Error, ...)=} callback
1654 * @return {function(...)} 1783 * @return {function(...)}
1655 * @template T 1784 * @template T
1656 */ 1785 */
1657 _markRevision(node, callback) { 1786 _markRevision(node, callback) {
1658 /** 1787 /**
1659 * @param {?Protocol.Error} error 1788 * @param {?Protocol.Error} error
1660 * @this {SDK.DOMModel} 1789 * @this {SDK.DOMModel}
1661 */ 1790 */
(...skipping 19 matching lines...) Expand all
1681 } 1810 }
1682 1811
1683 /** 1812 /**
1684 * @param {function(?Protocol.Error)=} callback 1813 * @param {function(?Protocol.Error)=} callback
1685 */ 1814 */
1686 redo(callback) { 1815 redo(callback) {
1687 this._agent.redo(callback); 1816 this._agent.redo(callback);
1688 } 1817 }
1689 1818
1690 /** 1819 /**
1820 * @param {?SDK.DOMNodeHighlighter} highlighter
1821 */
1822 setHighlighter(highlighter) {
1823 this._highlighter = highlighter || this._defaultHighlighter;
1824 }
1825
1826 /**
1691 * @param {number} x 1827 * @param {number} x
1692 * @param {number} y 1828 * @param {number} y
1693 * @param {boolean} includeUserAgentShadowDOM 1829 * @param {boolean} includeUserAgentShadowDOM
1694 * @param {function(?SDK.DOMNode)} callback 1830 * @param {function(?SDK.DOMNode)} callback
1695 */ 1831 */
1696 nodeForLocation(x, y, includeUserAgentShadowDOM, callback) { 1832 nodeForLocation(x, y, includeUserAgentShadowDOM, callback) {
1697 this._agent.getNodeForLocation(x, y, includeUserAgentShadowDOM, mycallback.b ind(this)); 1833 this._agent.getNodeForLocation(x, y, includeUserAgentShadowDOM, mycallback.b ind(this));
1698 1834
1699 /** 1835 /**
1700 * @param {?Protocol.Error} error 1836 * @param {?Protocol.Error} error
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1755 return new Promise(promiseBody.bind(this)); 1891 return new Promise(promiseBody.bind(this));
1756 1892
1757 /** 1893 /**
1758 * @param {function()} fulfill 1894 * @param {function()} fulfill
1759 * @this {SDK.DOMModel} 1895 * @this {SDK.DOMModel}
1760 */ 1896 */
1761 function promiseBody(fulfill) { 1897 function promiseBody(fulfill) {
1762 this._agent.enable(fulfill); 1898 this._agent.enable(fulfill);
1763 } 1899 }
1764 } 1900 }
1901
1902 /**
1903 * @param {!Protocol.DOM.NodeId} nodeId
1904 */
1905 nodeHighlightRequested(nodeId) {
1906 var node = this.nodeForId(nodeId);
1907 if (!node)
1908 return;
1909
1910 this.dispatchEventToListeners(SDK.DOMModel.Events.NodeHighlightedInOverlay, node);
1911 }
1765 }; 1912 };
1766 1913
1767 SDK.SDKModel.register(SDK.DOMModel, SDK.Target.Capability.DOM, true); 1914 SDK.SDKModel.register(SDK.DOMModel, SDK.Target.Capability.DOM, true);
1768 1915
1769 /** @enum {symbol} */ 1916 /** @enum {symbol} */
1770 SDK.DOMModel.Events = { 1917 SDK.DOMModel.Events = {
1771 AttrModified: Symbol('AttrModified'), 1918 AttrModified: Symbol('AttrModified'),
1772 AttrRemoved: Symbol('AttrRemoved'), 1919 AttrRemoved: Symbol('AttrRemoved'),
1773 CharacterDataModified: Symbol('CharacterDataModified'), 1920 CharacterDataModified: Symbol('CharacterDataModified'),
1774 DOMMutated: Symbol('DOMMutated'), 1921 DOMMutated: Symbol('DOMMutated'),
1775 NodeInserted: Symbol('NodeInserted'), 1922 NodeInserted: Symbol('NodeInserted'),
1923 NodeInspected: Symbol('NodeInspected'),
1924 NodeHighlightedInOverlay: Symbol('NodeHighlightedInOverlay'),
1776 NodeRemoved: Symbol('NodeRemoved'), 1925 NodeRemoved: Symbol('NodeRemoved'),
1777 DocumentUpdated: Symbol('DocumentUpdated'), 1926 DocumentUpdated: Symbol('DocumentUpdated'),
1778 ChildNodeCountUpdated: Symbol('ChildNodeCountUpdated'), 1927 ChildNodeCountUpdated: Symbol('ChildNodeCountUpdated'),
1779 DistributedNodesChanged: Symbol('DistributedNodesChanged'), 1928 DistributedNodesChanged: Symbol('DistributedNodesChanged'),
1929 InspectModeWillBeToggled: Symbol('InspectModeWillBeToggled'),
1780 MarkersChanged: Symbol('MarkersChanged') 1930 MarkersChanged: Symbol('MarkersChanged')
1781 }; 1931 };
1782 1932
1783 1933
1784 /** 1934 /**
1785 * @implements {Protocol.DOMDispatcher} 1935 * @implements {Protocol.DOMDispatcher}
1786 * @unrestricted 1936 * @unrestricted
1787 */ 1937 */
1788 SDK.DOMDispatcher = class { 1938 SDK.DOMDispatcher = class {
1789 /** 1939 /**
1790 * @param {!SDK.DOMModel} domModel 1940 * @param {!SDK.DOMModel} domModel
1791 */ 1941 */
1792 constructor(domModel) { 1942 constructor(domModel) {
1793 this._domModel = domModel; 1943 this._domModel = domModel;
1794 } 1944 }
1795 1945
1796 /** 1946 /**
1797 * @override 1947 * @override
1798 */ 1948 */
1799 documentUpdated() { 1949 documentUpdated() {
1800 this._domModel._documentUpdated(); 1950 this._domModel._documentUpdated();
1801 } 1951 }
1802 1952
1803 /** 1953 /**
1804 * @override 1954 * @override
1805 * @param {!Protocol.DOM.NodeId} nodeId 1955 * @param {!Protocol.DOM.NodeId} nodeId
1956 */
1957 inspectNodeRequested(nodeId) {
1958 this._domModel._inspectNodeRequested(nodeId);
1959 }
1960
1961 /**
1962 * @override
1963 * @param {!Protocol.DOM.NodeId} nodeId
1806 * @param {string} name 1964 * @param {string} name
1807 * @param {string} value 1965 * @param {string} value
1808 */ 1966 */
1809 attributeModified(nodeId, name, value) { 1967 attributeModified(nodeId, name, value) {
1810 this._domModel._attributeModified(nodeId, name, value); 1968 this._domModel._attributeModified(nodeId, name, value);
1811 } 1969 }
1812 1970
1813 /** 1971 /**
1814 * @override 1972 * @override
1815 * @param {!Protocol.DOM.NodeId} nodeId 1973 * @param {!Protocol.DOM.NodeId} nodeId
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 } 2068 }
1911 2069
1912 /** 2070 /**
1913 * @override 2071 * @override
1914 * @param {!Protocol.DOM.NodeId} insertionPointId 2072 * @param {!Protocol.DOM.NodeId} insertionPointId
1915 * @param {!Array.<!Protocol.DOM.BackendNode>} distributedNodes 2073 * @param {!Array.<!Protocol.DOM.BackendNode>} distributedNodes
1916 */ 2074 */
1917 distributedNodesUpdated(insertionPointId, distributedNodes) { 2075 distributedNodesUpdated(insertionPointId, distributedNodes) {
1918 this._domModel._distributedNodesUpdated(insertionPointId, distributedNodes); 2076 this._domModel._distributedNodesUpdated(insertionPointId, distributedNodes);
1919 } 2077 }
2078
2079 /**
2080 * @override
2081 * @param {!Protocol.DOM.NodeId} nodeId
2082 */
2083 nodeHighlightRequested(nodeId) {
2084 this._domModel.nodeHighlightRequested(nodeId);
2085 }
1920 }; 2086 };
2087
2088 /**
2089 * @interface
2090 */
2091 SDK.DOMNodeHighlighter = function() {};
2092
2093 SDK.DOMNodeHighlighter.prototype = {
2094 /**
2095 * @param {?SDK.DOMNode} node
2096 * @param {!Protocol.DOM.HighlightConfig} config
2097 * @param {!Protocol.DOM.BackendNodeId=} backendNodeId
2098 * @param {!Protocol.Runtime.RemoteObjectId=} objectId
2099 */
2100 highlightDOMNode(node, config, backendNodeId, objectId) {},
2101
2102 /**
2103 * @param {!Protocol.DOM.InspectMode} mode
2104 * @param {!Protocol.DOM.HighlightConfig} config
2105 * @param {function(?Protocol.Error)=} callback
2106 */
2107 setInspectMode(mode, config, callback) {},
2108
2109 /**
2110 * @param {!Protocol.Page.FrameId} frameId
2111 */
2112 highlightFrame(frameId) {}
2113 };
2114
2115 /**
2116 * @implements {SDK.DOMNodeHighlighter}
2117 * @unrestricted
2118 */
2119 SDK.DefaultDOMNodeHighlighter = class {
2120 /**
2121 * @param {!Protocol.DOMAgent} agent
2122 */
2123 constructor(agent) {
2124 this._agent = agent;
2125 }
2126
2127 /**
2128 * @override
2129 * @param {?SDK.DOMNode} node
2130 * @param {!Protocol.DOM.HighlightConfig} config
2131 * @param {!Protocol.DOM.BackendNodeId=} backendNodeId
2132 * @param {!Protocol.Runtime.RemoteObjectId=} objectId
2133 */
2134 highlightDOMNode(node, config, backendNodeId, objectId) {
2135 if (objectId || node || backendNodeId)
2136 this._agent.highlightNode(config, (objectId || backendNodeId) ? undefined : node.id, backendNodeId, objectId);
2137 else
2138 this._agent.hideHighlight();
2139 }
2140
2141 /**
2142 * @override
2143 * @param {!Protocol.DOM.InspectMode} mode
2144 * @param {!Protocol.DOM.HighlightConfig} config
2145 * @param {function(?Protocol.Error)=} callback
2146 */
2147 setInspectMode(mode, config, callback) {
2148 this._agent.setInspectMode(mode, config, callback);
2149 }
2150
2151 /**
2152 * @override
2153 * @param {!Protocol.Page.FrameId} frameId
2154 */
2155 highlightFrame(frameId) {
2156 this._agent.highlightFrame(
2157 frameId, Common.Color.PageHighlight.Content.toProtocolRGBA(),
2158 Common.Color.PageHighlight.ContentOutline.toProtocolRGBA());
2159 }
2160 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698