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

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

Issue 1311783003: Devtools[LayoutEditor]: Rework layout-editor workflow (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@resize
Patch Set: Created 5 years, 4 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 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 870
871 /** 871 /**
872 * @param {string=} mode 872 * @param {string=} mode
873 * @param {!RuntimeAgent.RemoteObjectId=} objectId 873 * @param {!RuntimeAgent.RemoteObjectId=} objectId
874 */ 874 */
875 highlight: function(mode, objectId) 875 highlight: function(mode, objectId)
876 { 876 {
877 this._domModel.highlightDOMNode(this.id, mode, undefined, objectId); 877 this._domModel.highlightDOMNode(this.id, mode, undefined, objectId);
878 }, 878 },
879 879
880 /**
881 * @param {!{mode: (string|undefined), showInfo: (boolean|undefined), showLa youtEditor: (boolean|undefined)}=} config
882 * @param {!RuntimeAgent.RemoteObjectId=} objectId
883 */
884 highlightWithConfig: function(config, objectId)
885 {
886 this._domModel.highlightDOMNodeWithConfig(this.id, config, undefined, ob jectId);
887 },
888
880 highlightForTwoSeconds: function() 889 highlightForTwoSeconds: function()
881 { 890 {
882 this._domModel.highlightDOMNodeForTwoSeconds(this.id); 891 this._domModel.highlightDOMNodeForTwoSeconds(this.id);
883 }, 892 },
884 893
885 /** 894 /**
886 * @param {string=} objectGroup 895 * @param {string=} objectGroup
887 * @param {function(?WebInspector.RemoteObject)=} callback 896 * @param {function(?WebInspector.RemoteObject)=} callback
888 */ 897 */
889 resolveToObject: function(objectGroup, callback) 898 resolveToObject: function(objectGroup, callback)
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 * @param {!DOMAgent.BackendNodeId=} backendNodeId 1712 * @param {!DOMAgent.BackendNodeId=} backendNodeId
1704 * @param {!RuntimeAgent.RemoteObjectId=} objectId 1713 * @param {!RuntimeAgent.RemoteObjectId=} objectId
1705 */ 1714 */
1706 highlightDOMNode: function(nodeId, mode, backendNodeId, objectId) 1715 highlightDOMNode: function(nodeId, mode, backendNodeId, objectId)
1707 { 1716 {
1708 this.highlightDOMNodeWithConfig(nodeId, { mode: mode }, backendNodeId, o bjectId); 1717 this.highlightDOMNodeWithConfig(nodeId, { mode: mode }, backendNodeId, o bjectId);
1709 }, 1718 },
1710 1719
1711 /** 1720 /**
1712 * @param {!DOMAgent.NodeId=} nodeId 1721 * @param {!DOMAgent.NodeId=} nodeId
1713 * @param {!{mode: (string|undefined), showInfo: (boolean|undefined)}=} conf ig 1722 * @param {!{mode: (string|undefined), showInfo: (boolean|undefined), showLa youtEditor: (boolean|undefined)}=} config
1714 * @param {!DOMAgent.BackendNodeId=} backendNodeId 1723 * @param {!DOMAgent.BackendNodeId=} backendNodeId
1715 * @param {!RuntimeAgent.RemoteObjectId=} objectId 1724 * @param {!RuntimeAgent.RemoteObjectId=} objectId
1716 */ 1725 */
1717 highlightDOMNodeWithConfig: function(nodeId, config, backendNodeId, objectId ) 1726 highlightDOMNodeWithConfig: function(nodeId, config, backendNodeId, objectId )
1718 { 1727 {
1719 config = config || { mode: "all", showInfo: undefined }; 1728 config = config || { mode: "all", showInfo: undefined, showLayoutEditor: undefined };
1720 if (this._hideDOMNodeHighlightTimeout) { 1729 if (this._hideDOMNodeHighlightTimeout) {
1721 clearTimeout(this._hideDOMNodeHighlightTimeout); 1730 clearTimeout(this._hideDOMNodeHighlightTimeout);
1722 delete this._hideDOMNodeHighlightTimeout; 1731 delete this._hideDOMNodeHighlightTimeout;
1723 } 1732 }
1724 var highlightConfig = this._buildHighlightConfig(config.mode); 1733 var highlightConfig = this._buildHighlightConfig(config.mode);
1725 if (typeof config.showInfo !== "undefined") 1734 if (typeof config.showInfo !== "undefined")
1726 highlightConfig.showInfo = config.showInfo; 1735 highlightConfig.showInfo = config.showInfo;
1736
1737 if (typeof config.showLayoutEditor !== undefined)
1738 highlightConfig.showLayoutEditor = config.showLayoutEditor;
pfeldman 2015/08/25 21:25:29 There should never be showLayoutEditor option in t
sergeyv 2015/08/26 02:25:49 Done.
1739
1727 this._highlighter.highlightDOMNode(this.nodeForId(nodeId || 0), highligh tConfig, backendNodeId, objectId); 1740 this._highlighter.highlightDOMNode(this.nodeForId(nodeId || 0), highligh tConfig, backendNodeId, objectId);
1728 }, 1741 },
1729 1742
1730 /** 1743 /**
1731 * @param {!DOMAgent.NodeId} nodeId 1744 * @param {!DOMAgent.NodeId} nodeId
1732 */ 1745 */
1733 highlightDOMNodeForTwoSeconds: function(nodeId) 1746 highlightDOMNodeForTwoSeconds: function(nodeId)
1734 { 1747 {
1735 this.highlightDOMNode(nodeId); 1748 this.highlightDOMNode(nodeId);
1736 this._hideDOMNodeHighlightTimeout = setTimeout(WebInspector.DOMModel.hid eDOMNodeHighlight.bind(WebInspector.DOMModel), 2000); 1749 this._hideDOMNodeHighlightTimeout = setTimeout(WebInspector.DOMModel.hid eDOMNodeHighlight.bind(WebInspector.DOMModel), 2000);
1737 }, 1750 },
1738 1751
1739 /** 1752 /**
1740 * @param {!PageAgent.FrameId} frameId 1753 * @param {!PageAgent.FrameId} frameId
1741 */ 1754 */
1742 highlightFrame: function(frameId) 1755 highlightFrame: function(frameId)
1743 { 1756 {
1744 this._highlighter.highlightFrame(frameId); 1757 this._highlighter.highlightFrame(frameId);
1745 }, 1758 },
1746 1759
1747 /** 1760 /**
1748 * @param {boolean} enabled 1761 * @param {boolean} enabled
1749 * @param {boolean} inspectUAShadowDOM 1762 * @param {?string} mode
pfeldman 2015/08/25 21:25:29 This all can be reverted.
sergeyv 2015/08/26 02:25:49 No, now we have LayoutEditor mode, so we need Stri
pfeldman 2015/08/26 21:04:48 But we never trigger layout editor through this co
1750 * @param {function(?Protocol.Error)=} callback 1763 * @param {function(?Protocol.Error)=} callback
1751 */ 1764 */
1752 setInspectModeEnabled: function(enabled, inspectUAShadowDOM, callback) 1765 setInspectModeEnabled: function(enabled, mode, callback)
1753 { 1766 {
1754 /** 1767 /**
1755 * @this {WebInspector.DOMModel} 1768 * @this {WebInspector.DOMModel}
1756 */ 1769 */
1757 function onDocumentAvailable() 1770 function onDocumentAvailable()
1758 { 1771 {
1759 this.dispatchEventToListeners(WebInspector.DOMModel.Events.InspectMo deWillBeToggled, enabled); 1772 this.dispatchEventToListeners(WebInspector.DOMModel.Events.InspectMo deWillBeToggled, enabled);
1760 this._highlighter.setInspectModeEnabled(enabled, inspectUAShadowDOM, this._buildHighlightConfig(), callback); 1773 this._highlighter.setInspectModeEnabled(enabled, mode, this._buildHi ghlightConfig(), callback);
1761 } 1774 }
1762 this.requestDocument(onDocumentAvailable.bind(this)); 1775 this.requestDocument(onDocumentAvailable.bind(this));
1763 }, 1776 },
1764 1777
1765 /** 1778 /**
1766 * @param {boolean} showRulers 1779 * @param {boolean} showRulers
1767 * @param {boolean} showExtensionLines 1780 * @param {boolean} showExtensionLines
1768 */ 1781 */
1769 setHighlightSettings: function(showRulers, showExtensionLines) 1782 setHighlightSettings: function(showRulers, showExtensionLines)
1770 { 1783 {
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
2094 /** 2107 /**
2095 * @param {?WebInspector.DOMNode} node 2108 * @param {?WebInspector.DOMNode} node
2096 * @param {!DOMAgent.HighlightConfig} config 2109 * @param {!DOMAgent.HighlightConfig} config
2097 * @param {!DOMAgent.BackendNodeId=} backendNodeId 2110 * @param {!DOMAgent.BackendNodeId=} backendNodeId
2098 * @param {!RuntimeAgent.RemoteObjectId=} objectId 2111 * @param {!RuntimeAgent.RemoteObjectId=} objectId
2099 */ 2112 */
2100 highlightDOMNode: function(node, config, backendNodeId, objectId) {}, 2113 highlightDOMNode: function(node, config, backendNodeId, objectId) {},
2101 2114
2102 /** 2115 /**
2103 * @param {boolean} enabled 2116 * @param {boolean} enabled
2104 * @param {boolean} inspectUAShadowDOM 2117 * @param {?string} mode
2105 * @param {!DOMAgent.HighlightConfig} config 2118 * @param {!DOMAgent.HighlightConfig} config
2106 * @param {function(?Protocol.Error)=} callback 2119 * @param {function(?Protocol.Error)=} callback
2107 */ 2120 */
2108 setInspectModeEnabled: function(enabled, inspectUAShadowDOM, config, callbac k) {}, 2121 setInspectModeEnabled: function(enabled, mode, config, callback) {},
2109 2122
2110 /** 2123 /**
2111 * @param {!PageAgent.FrameId} frameId 2124 * @param {!PageAgent.FrameId} frameId
2112 */ 2125 */
2113 highlightFrame: function(frameId) {} 2126 highlightFrame: function(frameId) {}
2114 } 2127 }
2115 2128
2116 /** 2129 /**
2117 * @constructor 2130 * @constructor
2118 * @implements {WebInspector.DOMNodeHighlighter} 2131 * @implements {WebInspector.DOMNodeHighlighter}
(...skipping 16 matching lines...) Expand all
2135 { 2148 {
2136 if (objectId || node || backendNodeId) 2149 if (objectId || node || backendNodeId)
2137 this._agent.highlightNode(config, (objectId || backendNodeId) ? unde fined : node.id, backendNodeId, objectId); 2150 this._agent.highlightNode(config, (objectId || backendNodeId) ? unde fined : node.id, backendNodeId, objectId);
2138 else 2151 else
2139 this._agent.hideHighlight(); 2152 this._agent.hideHighlight();
2140 }, 2153 },
2141 2154
2142 /** 2155 /**
2143 * @override 2156 * @override
2144 * @param {boolean} enabled 2157 * @param {boolean} enabled
2145 * @param {boolean} inspectUAShadowDOM 2158 * @param {?string} mode
2146 * @param {!DOMAgent.HighlightConfig} config 2159 * @param {!DOMAgent.HighlightConfig} config
2147 * @param {function(?Protocol.Error)=} callback 2160 * @param {function(?Protocol.Error)=} callback
2148 */ 2161 */
2149 setInspectModeEnabled: function(enabled, inspectUAShadowDOM, config, callbac k) 2162 setInspectModeEnabled: function(enabled, mode, config, callback)
2150 { 2163 {
2151 this._agent.setInspectModeEnabled(enabled, inspectUAShadowDOM, config, c allback); 2164 this._agent.setInspectModeEnabled(enabled, mode || undefined, config, ca llback);
2152 }, 2165 },
2153 2166
2154 /** 2167 /**
2155 * @override 2168 * @override
2156 * @param {!PageAgent.FrameId} frameId 2169 * @param {!PageAgent.FrameId} frameId
2157 */ 2170 */
2158 highlightFrame: function(frameId) 2171 highlightFrame: function(frameId)
2159 { 2172 {
2160 this._agent.highlightFrame(frameId, WebInspector.Color.PageHighlight.Con tent.toProtocolRGBA(), WebInspector.Color.PageHighlight.ContentOutline.toProtoco lRGBA()); 2173 this._agent.highlightFrame(frameId, WebInspector.Color.PageHighlight.Con tent.toProtocolRGBA(), WebInspector.Color.PageHighlight.ContentOutline.toProtoco lRGBA());
2161 } 2174 }
2162 } 2175 }
2163 2176
2164 /** 2177 /**
2165 * @param {!WebInspector.Target} target 2178 * @param {!WebInspector.Target} target
2166 * @return {?WebInspector.DOMModel} 2179 * @return {?WebInspector.DOMModel}
2167 */ 2180 */
2168 WebInspector.DOMModel.fromTarget = function(target) 2181 WebInspector.DOMModel.fromTarget = function(target)
2169 { 2182 {
2170 return /** @type {?WebInspector.DOMModel} */ (target.model(WebInspector.DOMM odel)); 2183 return /** @type {?WebInspector.DOMModel} */ (target.model(WebInspector.DOMM odel));
2171 } 2184 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698