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

Side by Side Diff: Source/devtools/front_end/layers/PaintProfilerView.js

Issue 328113005: DevTools: Add popover for snapshot canvas log. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixes. Created 6 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 * @constructor 198 * @constructor
199 * @extends {WebInspector.VBox} 199 * @extends {WebInspector.VBox}
200 */ 200 */
201 WebInspector.PaintProfilerCommandLogView = function() 201 WebInspector.PaintProfilerCommandLogView = function()
202 { 202 {
203 WebInspector.VBox.call(this); 203 WebInspector.VBox.call(this);
204 this.setMinimumSize(100, 25); 204 this.setMinimumSize(100, 25);
205 this.element.classList.add("outline-disclosure"); 205 this.element.classList.add("outline-disclosure");
206 var sidebarTreeElement = this.element.createChild("ol", "sidebar-tree"); 206 var sidebarTreeElement = this.element.createChild("ol", "sidebar-tree");
207 this.sidebarTree = new TreeOutline(sidebarTreeElement); 207 this.sidebarTree = new TreeOutline(sidebarTreeElement);
208 this._popoverHelper = new WebInspector.ObjectPopoverHelper(this.element, thi s._getHoverAnchor.bind(this), this._resolveObjectForPopover.bind(this), undefine d, true);
208 209
209 this._log = []; 210 this._log = [];
210 } 211 }
211 212
212 WebInspector.PaintProfilerCommandLogView.prototype = { 213 WebInspector.PaintProfilerCommandLogView.prototype = {
213 setLog: function(log) 214 setLog: function(log)
214 { 215 {
215 this._log = log; 216 this._log = log;
216 }, 217 },
217 218
218 /** 219 /**
219 * @param {number=} stepLeft 220 * @param {number=} stepLeft
220 * @param {number=} stepRight 221 * @param {number=} stepRight
221 */ 222 */
222 updateLog: function(stepLeft, stepRight) 223 updateLog: function(stepLeft, stepRight)
223 { 224 {
224 var log = this._log; 225 var log = this._log;
225 stepLeft = stepLeft || 0; 226 stepLeft = stepLeft || 0;
226 stepRight = stepRight || log.length - 1; 227 stepRight = stepRight || log.length - 1;
227 this.sidebarTree.removeChildren(); 228 this.sidebarTree.removeChildren();
228 for (var i = stepLeft; i <= stepRight; ++i) { 229 for (var i = stepLeft; i <= stepRight; ++i) {
229 var node = new WebInspector.LogTreeElement(log[i]); 230 var node = new WebInspector.LogTreeElement(log[i]);
230 this.sidebarTree.appendChild(node); 231 this.sidebarTree.appendChild(node);
231 } 232 }
232 }, 233 },
233 234
235 /**
236 * @param {!Element} target
237 * @return {!Element}
238 */
239 _getHoverAnchor: function(target)
240 {
241 return target.enclosingNodeOrSelfWithNodeName("span");
242 },
243
244 /**
245 * @param {!Element} element
246 * @param {function(!WebInspector.RemoteObject, boolean, !Element=):undefine d} showCallback
247 */
248 _resolveObjectForPopover: function(element, showCallback)
249 {
250 var liElement = element.enclosingNodeOrSelfWithNodeName("li");
251 var logItem = liElement.treeElement.representedObject;
252 var obj = {"method": logItem.method};
253 if (logItem.params)
254 obj.params = logItem.params;
255 showCallback(WebInspector.RemoteObject.fromLocalObject(obj), false);
256 },
257
234 __proto__: WebInspector.VBox.prototype 258 __proto__: WebInspector.VBox.prototype
235 }; 259 };
236 260
237 /** 261 /**
238 * @constructor 262 * @constructor
239 * @param {!Object} logItem 263 * @param {!Object} logItem
240 * @extends {TreeElement} 264 * @extends {TreeElement}
241 */ 265 */
242 WebInspector.LogTreeElement = function(logItem) 266 WebInspector.LogTreeElement = function(logItem)
243 { 267 {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 str += this._paramToString(params[key], key); 304 str += this._paramToString(params[key], key);
281 } 305 }
282 return str; 306 return str;
283 }, 307 },
284 308
285 _update: function() 309 _update: function()
286 { 310 {
287 var logItem = this.representedObject; 311 var logItem = this.representedObject;
288 var title = document.createDocumentFragment(); 312 var title = document.createDocumentFragment();
289 title.createChild("div", "selection"); 313 title.createChild("div", "selection");
314 var span = title.createChild("span");
caseq 2014/06/11 16:48:36 This change is probably redundant now.
malch 2014/06/11 16:50:44 We need this to properly show the popover. On 2014
290 var textContent = logItem.method; 315 var textContent = logItem.method;
291 if (logItem.params) 316 if (logItem.params)
292 textContent += "(" + this._paramsToString(logItem.params) + ")"; 317 textContent += "(" + this._paramsToString(logItem.params) + ")";
293 title.appendChild(document.createTextNode(textContent)); 318 span.textContent = textContent;
294 this.title = title; 319 this.title = title;
295 }, 320 },
296 321
297 /** 322 /**
298 * @param {boolean} hovered 323 * @param {boolean} hovered
299 */ 324 */
300 setHovered: function(hovered) 325 setHovered: function(hovered)
301 { 326 {
302 this.listItemElement.classList.toggle("hovered", hovered); 327 this.listItemElement.classList.toggle("hovered", hovered);
303 }, 328 },
304 329
305 __proto__: TreeElement.prototype 330 __proto__: TreeElement.prototype
306 }; 331 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698