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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/NetworkLogView.js

Issue 2412013002: [Devtools] Added hover support for network timeline experiment (Closed)
Patch Set: Changes Created 4 years, 2 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) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org>
4 * Copyright (C) 2011 Google Inc. All rights reserved. 4 * Copyright (C) 2011 Google Inc. All rights reserved.
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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 this._splitWidget.setSidebarWidget(this._dataGrid.asWidget()); 287 this._splitWidget.setSidebarWidget(this._dataGrid.asWidget());
288 288
289 this._summaryBarElement = this.element.createChild("div", "network-s ummary-bar"); 289 this._summaryBarElement = this.element.createChild("div", "network-s ummary-bar");
290 290
291 this._timelineWidget = new WebInspector.VBox(); 291 this._timelineWidget = new WebInspector.VBox();
292 this._createTimelineHeader(); 292 this._createTimelineHeader();
293 this._timelineWidget.element.classList.add("network-timeline-view"); 293 this._timelineWidget.element.classList.add("network-timeline-view");
294 this._splitWidget.setMainWidget(this._timelineWidget); 294 this._splitWidget.setMainWidget(this._timelineWidget);
295 295
296 this._timelineColumn = new WebInspector.NetworkTimelineColumn(this, this._dataGrid); 296 this._timelineColumn = new WebInspector.NetworkTimelineColumn(this, this._dataGrid);
297 this._timelineColumn.addEventListener(WebInspector.NetworkTimelineCo lumn.Events.RequestHovered, requestHovered.bind(this));
297 this._timelineColumn.show(this._timelineWidget.element); 298 this._timelineColumn.show(this._timelineWidget.element);
298 this.switchViewMode(false); 299 this.switchViewMode(false);
299 } else { 300 } else {
300 this._createTable(); 301 this._createTable();
301 this._dataGrid.asWidget().show(this.element); 302 this._dataGrid.asWidget().show(this.element);
302 this._summaryBarElement = this.element.createChild("div", "network-s ummary-bar"); 303 this._summaryBarElement = this.element.createChild("div", "network-s ummary-bar");
303 } 304 }
304 305
305 this._columns.sortByCurrentColumn(); 306 this._columns.sortByCurrentColumn();
306 this._updateRowsSize(); 307 this._updateRowsSize();
308
309 /**
310 * @param {!WebInspector.Event} event
311 * @this {WebInspector.NetworkLogView}
312 */
313 function requestHovered(event)
314 {
315 var request = /** @type {?WebInspector.NetworkRequest} */ (event.dat a);
316 var node = request ? this._nodesByRequestId.get(request.requestId) : null;
317 this._setHoveredNode(node || null);
318 }
307 }, 319 },
308 320
309 _showRecordingHint: function() 321 _showRecordingHint: function()
310 { 322 {
311 this._hideRecordingHint(); 323 this._hideRecordingHint();
312 this._recordingHint = this.element.createChild("div", "network-status-pa ne fill"); 324 this._recordingHint = this.element.createChild("div", "network-status-pa ne fill");
313 var hintText = this._recordingHint.createChild("div", "recording-hint"); 325 var hintText = this._recordingHint.createChild("div", "recording-hint");
314 var reloadShortcutNode = this._recordingHint.createChild("b"); 326 var reloadShortcutNode = this._recordingHint.createChild("b");
315 reloadShortcutNode.textContent = WebInspector.shortcutRegistry.shortcutD escriptorsForAction("main.reload")[0].name; 327 reloadShortcutNode.textContent = WebInspector.shortcutRegistry.shortcutD escriptorsForAction("main.reload")[0].name;
316 328
(...skipping 30 matching lines...) Expand all
347 _createTable: function() 359 _createTable: function()
348 { 360 {
349 this._dataGrid = this._columns.createGrid(this._timeCalculator, this._du rationCalculator); 361 this._dataGrid = this._columns.createGrid(this._timeCalculator, this._du rationCalculator);
350 this._dataGrid.setStickToBottom(true); 362 this._dataGrid.setStickToBottom(true);
351 this._dataGrid.setName("networkLog"); 363 this._dataGrid.setName("networkLog");
352 this._dataGrid.setResizeMethod(WebInspector.DataGrid.ResizeMethod.Last); 364 this._dataGrid.setResizeMethod(WebInspector.DataGrid.ResizeMethod.Last);
353 this._dataGrid.element.classList.add("network-log-grid"); 365 this._dataGrid.element.classList.add("network-log-grid");
354 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu .bind(this), true); 366 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu .bind(this), true);
355 this._dataGrid.element.addEventListener("mousedown", this._dataGridMouse Down.bind(this), true); 367 this._dataGrid.element.addEventListener("mousedown", this._dataGridMouse Down.bind(this), true);
356 this._dataGrid.element.addEventListener("mousemove", this._dataGridMouse Move.bind(this), true); 368 this._dataGrid.element.addEventListener("mousemove", this._dataGridMouse Move.bind(this), true);
357 this._dataGrid.element.addEventListener("mouseleave", this._highlightIni tiatorChain.bind(this, null), true); 369 this._dataGrid.element.addEventListener("mouseleave", this._dataGridMous eLeave.bind(this), true);
370 },
371
372 /**
373 * @param {!Event} event
374 */
375 _dataGridMouseMove: function(event)
376 {
377 var node = this._dataGrid.dataGridNodeFromNode(event.target);
378 this._setHoveredNode(node);
379 this._highlightInitiatorChain((event.shiftKey && node) ? node.request() : null);
380 },
381
382 _dataGridMouseLeave: function()
383 {
384 if (this._hoveredNode) {
dgozman 2016/10/12 21:05:38 this._setHoveredNode(null);
allada 2016/10/12 21:12:43 Done.
385 this._hoveredNode.element().classList.remove("hover");
386 this._hoveredNode = null;
387 this._timelineColumn.setHoveredRequest(null);
388 }
389 this._highlightInitiatorChain(null);
390 },
391
392 /**
393 * @param {?WebInspector.NetworkDataGridNode} node
394 */
395 _setHoveredNode: function(node)
396 {
397 if (this._hoveredNode)
398 this._hoveredNode.element().classList.remove("hover");
399 this._hoveredNode = node;
400 if (this._hoveredNode)
401 this._hoveredNode.element().classList.add("hover");
402 this._timelineColumn.setHoveredRequest(this._hoveredNode ? this._hovered Node.request() : null);
358 }, 403 },
359 404
360 /** 405 /**
361 * @param {!Event} event 406 * @param {!Event} event
362 */ 407 */
363 _dataGridMouseDown: function(event) 408 _dataGridMouseDown: function(event)
364 { 409 {
365 if ((!this._dataGrid.selectedNode && event.button) || event.target.enclo singNodeOrSelfWithNodeName("a")) 410 if ((!this._dataGrid.selectedNode && event.button) || event.target.enclo singNodeOrSelfWithNodeName("a"))
366 event.consume(); 411 event.consume();
367 }, 412 },
368 413
369 /** 414 /**
370 * @param {!Event} event
371 */
372 _dataGridMouseMove: function(event)
373 {
374 var node = event.shiftKey ? this._dataGrid.dataGridNodeFromNode(event.ta rget) : null;
375 this._highlightInitiatorChain(node ? node.request() : null);
376 },
377
378 /**
379 * @param {?WebInspector.NetworkRequest} request 415 * @param {?WebInspector.NetworkRequest} request
380 */ 416 */
381 _highlightInitiatorChain: function(request) 417 _highlightInitiatorChain: function(request)
382 { 418 {
383 if (this._requestWithHighlightedInitiators === request) 419 if (this._requestWithHighlightedInitiators === request)
384 return; 420 return;
385 this._requestWithHighlightedInitiators = request; 421 this._requestWithHighlightedInitiators = request;
386 422
387 if (!request) { 423 if (!request) {
388 for (var node of this._nodesByRequestId.values()) { 424 for (var node of this._nodesByRequestId.values()) {
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1817 * @return {boolean} 1853 * @return {boolean}
1818 */ 1854 */
1819 WebInspector.NetworkLogView._requestTimeFilter = function(windowStart, windowEnd , request) 1855 WebInspector.NetworkLogView._requestTimeFilter = function(windowStart, windowEnd , request)
1820 { 1856 {
1821 if (request.issueTime() > windowEnd) 1857 if (request.issueTime() > windowEnd)
1822 return false; 1858 return false;
1823 if (request.endTime !== -1 && request.endTime < windowStart) 1859 if (request.endTime !== -1 && request.endTime < windowStart)
1824 return false; 1860 return false;
1825 return true; 1861 return true;
1826 } 1862 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698