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

Side by Side Diff: Source/devtools/front_end/network/NetworkPanel.js

Issue 297893003: Devtools: DataGrid: do not render hidden columns. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed TODO Created 6 years, 7 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 columns.push({ 337 columns.push({
338 id: "timeline", 338 id: "timeline",
339 titleDOMFragment: document.createDocumentFragment(), 339 titleDOMFragment: document.createDocumentFragment(),
340 title: WebInspector.UIString("Timeline"), 340 title: WebInspector.UIString("Timeline"),
341 sortable: false, 341 sortable: false,
342 weight: 40, 342 weight: 40,
343 sort: WebInspector.DataGrid.Order.Ascending 343 sort: WebInspector.DataGrid.Order.Ascending
344 }); 344 });
345 345
346 this._dataGrid = new WebInspector.DataGrid(columns); 346 this._dataGrid = new WebInspector.DataGrid(columns);
347 this._updateColumns();
347 this._dataGrid.setName("networkLog"); 348 this._dataGrid.setName("networkLog");
348 this._dataGrid.resizeMethod = WebInspector.DataGrid.ResizeMethod.Last; 349 this._dataGrid.resizeMethod = WebInspector.DataGrid.ResizeMethod.Last;
349 this._dataGrid.element.classList.add("network-log-grid"); 350 this._dataGrid.element.classList.add("network-log-grid");
350 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu .bind(this), true); 351 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu .bind(this), true);
351 this._dataGrid.show(this.element); 352 this._dataGrid.show(this.element);
352 353
353 // Event listeners need to be added _after_ we attach to the document, s o that owner document is properly update. 354 // Event listeners need to be added _after_ we attach to the document, s o that owner document is properly update.
354 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChan ged, this._sortItems, this); 355 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChan ged, this._sortItems, this);
355 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResi zed, this._updateDividersIfNeeded, this); 356 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResi zed, this._updateDividersIfNeeded, this);
356 357
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 } 729 }
729 730
730 for (var requestId in this._staleRequests) { 731 for (var requestId in this._staleRequests) {
731 var request = this._staleRequests[requestId]; 732 var request = this._staleRequests[requestId];
732 var node = this._requestGridNode(request); 733 var node = this._requestGridNode(request);
733 if (!node) { 734 if (!node) {
734 // Create the timeline tree element and graph. 735 // Create the timeline tree element and graph.
735 node = this._createRequestGridNode(request); 736 node = this._createRequestGridNode(request);
736 this._dataGrid.rootNode().appendChild(node); 737 this._dataGrid.rootNode().appendChild(node);
737 } 738 }
738 node.refreshRequest(); 739 node.refresh();
739 this._applyFilter(node); 740 this._applyFilter(node);
740 741
741 if (this.calculator.updateBoundaries(request)) 742 if (this.calculator.updateBoundaries(request))
742 boundariesChanged = true; 743 boundariesChanged = true;
743 744
744 if (!node.isFilteredOut()) 745 if (!node.isFilteredOut())
745 this._updateHighlightIfMatched(request); 746 this._updateHighlightIfMatched(request);
746 } 747 }
747 748
748 if (boundariesChanged) { 749 if (boundariesChanged) {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 row.createChild("td").textContent = stackFrame.functionName || WebIn spector.UIString("(anonymous function)"); 993 row.createChild("td").textContent = stackFrame.functionName || WebIn spector.UIString("(anonymous function)");
993 row.createChild("td").textContent = " @ "; 994 row.createChild("td").textContent = " @ ";
994 row.createChild("td").appendChild(this._linkifier.linkifyLocation(re quest.target(), stackFrame.url, stackFrame.lineNumber - 1, stackFrame.columnNumb er - 1)); 995 row.createChild("td").appendChild(this._linkifier.linkifyLocation(re quest.target(), stackFrame.url, stackFrame.lineNumber - 1, stackFrame.columnNumb er - 1));
995 framesTable.appendChild(row); 996 framesTable.appendChild(row);
996 } 997 }
997 return framesTable; 998 return framesTable;
998 }, 999 },
999 1000
1000 _updateColumns: function() 1001 _updateColumns: function()
1001 { 1002 {
1002 var columnsVisibility = this._coulmnsVisibilitySetting.get();
1003 var detailedMode = !!this._detailedMode; 1003 var detailedMode = !!this._detailedMode;
1004 for (var columnIdentifier in columnsVisibility) { 1004 var visibleColumns = {"name": true};
1005 var visible = detailedMode && columnsVisibility[columnIdentifier]; 1005 if (detailedMode) {
1006 this._dataGrid.setColumnVisible(columnIdentifier, visible); 1006 visibleColumns["timeline"] = true;
1007 var columnsVisibility = this._coulmnsVisibilitySetting.get();
1008 for (var columnIdentifier in columnsVisibility)
1009 visibleColumns[columnIdentifier] = columnsVisibility[columnIdent ifier];
1007 } 1010 }
1008 this._dataGrid.setColumnVisible("timeline", detailedMode); 1011
1009 this._dataGrid.applyColumnWeights(); 1012 this._dataGrid.setColumnsVisiblity(visibleColumns);
1010 }, 1013 },
1011 1014
1012 /** 1015 /**
1013 * @param {string} columnIdentifier 1016 * @param {string} columnIdentifier
1014 */ 1017 */
1015 _toggleColumnVisibility: function(columnIdentifier) 1018 _toggleColumnVisibility: function(columnIdentifier)
1016 { 1019 {
1017 var columnsVisibility = this._coulmnsVisibilitySetting.get(); 1020 var columnsVisibility = this._coulmnsVisibilitySetting.get();
1018 columnsVisibility[columnIdentifier] = !columnsVisibility[columnIdentifie r]; 1021 columnsVisibility[columnIdentifier] = !columnsVisibility[columnIdentifie r];
1019 this._coulmnsVisibilitySetting.set(columnsVisibility); 1022 this._coulmnsVisibilitySetting.set(columnsVisibility);
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after
2406 WebInspector.DataGridNode.call(this, {}); 2409 WebInspector.DataGridNode.call(this, {});
2407 this._parentView = parentView; 2410 this._parentView = parentView;
2408 this._request = request; 2411 this._request = request;
2409 this._linkifier = new WebInspector.Linkifier(); 2412 this._linkifier = new WebInspector.Linkifier();
2410 } 2413 }
2411 2414
2412 WebInspector.NetworkDataGridNode.prototype = { 2415 WebInspector.NetworkDataGridNode.prototype = {
2413 /** override */ 2416 /** override */
2414 createCells: function() 2417 createCells: function()
2415 { 2418 {
2416 this._nameCell = this._createCell("name"); 2419 delete this._nameCell;
2417 this._methodCell = this._createCell("method"); 2420 delete this._timelineCell;
2418 this._statusCell = this._createCell("status");
2419 this._schemeCell = this._createCell("scheme");
2420 this._domainCell = this._createCell("domain");
2421 this._remoteAddressCell = this._createCell("remoteAddress");
2422 this._typeCell = this._createCell("type");
2423 this._initiatorCell = this._createCell("initiator");
2424 this._cookiesCell = this._createCell("cookies");
2425 this._setCookiesCell = this._createCell("setCookies");
2426 this._sizeCell = this._createCell("size");
2427 this._timeCell = this._createCell("time");
2428 2421
2429 this._responseHeaderCells = {}; 2422 var element = this._element;
2430 var responseHeaderColumns = WebInspector.NetworkLogView._responseHeaderC olumns; 2423 element.classList.toggle("network-error-row", this._isFailed());
2431 for (var i = 0; i < responseHeaderColumns.length; ++i) 2424 element.classList.toggle("resource-cached", this._request.cached);
2432 this._responseHeaderCells[responseHeaderColumns[i]] = this._createCe ll(responseHeaderColumns[i]); 2425 var typeClassName = "network-type-" + this._request.type.name();
2426 if (!element.classList.contains(typeClassName)) {
2427 element.removeMatchingStyleClasses("network-type-\\w+");
2428 element.classList.add(typeClassName);
2429 }
2433 2430
2434 var timelineCell = this._createCell("timeline"); 2431 WebInspector.DataGridNode.prototype.createCells.call(this);
2435 this._timelineCell = timelineCell.createChild("div"); 2432
2436 this._createTimelineBar(this._timelineCell); 2433 this.refreshGraph(this._parentView.calculator);
2437 this._nameCell.addEventListener("click", this._onClick.bind(this), false ); 2434 },
2438 this._nameCell.addEventListener("dblclick", this._openInNewTab.bind(this ), false); 2435
2436 /**
2437 * @override
2438 * @param {string} columnIdentifier
2439 * @return {!Element}
2440 */
2441 createCell: function(columnIdentifier)
2442 {
2443 var cell = this.createTD(columnIdentifier);
2444 switch (columnIdentifier) {
2445 case "name": this._renderNameCell(cell); break;
2446 case "timeline": this._createTimelineBar(cell); break;
2447 case "method": cell.setTextAndTitle(this._request.requestMethod); break;
2448 case "scheme": cell.setTextAndTitle(this._request.scheme); break;
2449 case "domain": cell.setTextAndTitle(this._request.domain); break;
2450 case "remoteAddress": cell.setTextAndTitle(this._request.remoteAddress() ); break;
2451 case "cookies": cell.setTextAndTitle(this._arrayLength(this._request.req uestCookies)); break;
2452 case "setCookies": cell.setTextAndTitle(this._arrayLength(this._request. responseCookies)); break;
2453 case "type": this._renderTypeCell(cell); break;
2454 case "initiator": this._renderInitiatorCell(cell); break;
2455 case "size": this._renderSizeCell(cell); break;
2456 case "time": this._renderTimeCell(cell); break;
2457 default: cell.setTextAndTitle(this._request.responseHeaderValue(columnId entifier) || ""); break;
2458 }
2459
2460 return cell;
2461 },
2462
2463 /**
2464 * @param array {?Array}
2465 * @return {string}
2466 */
2467 _arrayLength: function(array)
2468 {
2469 return array ? "" + array.length : "";
2439 }, 2470 },
2440 2471
2441 wasDetached: function() 2472 wasDetached: function()
2442 { 2473 {
2443 this._linkifier.reset(); 2474 this._linkifier.reset();
2444 }, 2475 },
2445 2476
2446 /** 2477 /**
2447 * @return {boolean} 2478 * @return {boolean}
2448 */ 2479 */
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2480 _openInNewTab: function() 2511 _openInNewTab: function()
2481 { 2512 {
2482 InspectorFrontendHost.openInNewTab(this._request.url); 2513 InspectorFrontendHost.openInNewTab(this._request.url);
2483 }, 2514 },
2484 2515
2485 get selectable() 2516 get selectable()
2486 { 2517 {
2487 return this._parentView._allowRequestSelection && !this.isFilteredOut(); 2518 return this._parentView._allowRequestSelection && !this.isFilteredOut();
2488 }, 2519 },
2489 2520
2490 _createCell: function(columnIdentifier) 2521 _createCell: function(columnIdentifier)
alph 2014/05/28 15:25:58 nuke this
eustas 2014/05/29 13:09:46 Done.
2491 { 2522 {
2492 var td = this.createTD(columnIdentifier); 2523 var td = this.createTD(columnIdentifier);
2493 this._element.appendChild(td); 2524 this._element.appendChild(td);
2494 return td; 2525 return td;
2495 }, 2526 },
2496 2527
2497 /** 2528 /**
2498 * @param {!Element} cell 2529 * @param {!Element} cell
2499 */ 2530 */
2500 _createTimelineBar: function(cell) 2531 _createTimelineBar: function(cell)
2501 { 2532 {
2533 cell = cell.createChild("div");
2534 this._timelineCell = cell;
2535
2502 cell.className = "network-graph-side"; 2536 cell.className = "network-graph-side";
2503 2537
2504 this._barAreaElement = document.createElement("div"); 2538 this._barAreaElement = document.createElement("div");
2505 // this._barAreaElement.className = "network-graph-bar-area hidden"; 2539 // this._barAreaElement.className = "network-graph-bar-area hidden";
2506 this._barAreaElement.className = "network-graph-bar-area"; 2540 this._barAreaElement.className = "network-graph-bar-area";
2507 this._barAreaElement.request = this._request; 2541 this._barAreaElement.request = this._request;
2508 cell.appendChild(this._barAreaElement); 2542 cell.appendChild(this._barAreaElement);
2509 2543
2510 this._barLeftElement = document.createElement("div"); 2544 this._barLeftElement = document.createElement("div");
2511 this._barLeftElement.className = "network-graph-bar waiting"; 2545 this._barLeftElement.className = "network-graph-bar waiting";
2512 this._barAreaElement.appendChild(this._barLeftElement); 2546 this._barAreaElement.appendChild(this._barLeftElement);
2513 2547
2514 this._barRightElement = document.createElement("div"); 2548 this._barRightElement = document.createElement("div");
2515 this._barRightElement.className = "network-graph-bar"; 2549 this._barRightElement.className = "network-graph-bar";
2516 this._barAreaElement.appendChild(this._barRightElement); 2550 this._barAreaElement.appendChild(this._barRightElement);
2517 2551
2518 2552
2519 this._labelLeftElement = document.createElement("div"); 2553 this._labelLeftElement = document.createElement("div");
2520 this._labelLeftElement.className = "network-graph-label waiting"; 2554 this._labelLeftElement.className = "network-graph-label waiting";
2521 this._barAreaElement.appendChild(this._labelLeftElement); 2555 this._barAreaElement.appendChild(this._labelLeftElement);
2522 2556
2523 this._labelRightElement = document.createElement("div"); 2557 this._labelRightElement = document.createElement("div");
2524 this._labelRightElement.className = "network-graph-label"; 2558 this._labelRightElement.className = "network-graph-label";
2525 this._barAreaElement.appendChild(this._labelRightElement); 2559 this._barAreaElement.appendChild(this._labelRightElement);
2526 2560
2527 cell.addEventListener("mouseover", this._refreshLabelPositions.bind(this ), false); 2561 cell.addEventListener("mouseover", this._refreshLabelPositions.bind(this ), false);
2528 }, 2562 },
2529 2563
2530 refreshRequest: function()
2531 {
2532 this._refreshNameCell();
2533 this._refreshMethodCell();
2534 this._refreshStatusCell();
2535 this._refreshSchemeCell();
2536 this._refreshDomainCell();
2537 this._refreshRemoteAddressCell();
2538 this._refreshTypeCell();
2539 this._refreshInitiatorCell();
2540 this._refreshCookiesCell();
2541 this._refreshSetCookiesCell();
2542 this._refreshSizeCell();
2543 this._refreshTimeCell();
2544
2545 var responseHeaderColumns = WebInspector.NetworkLogView._responseHeaderC olumns;
2546 for (var i = 0; i < responseHeaderColumns.length; ++i)
2547 this._refreshResponseHeaderCell(responseHeaderColumns[i]);
2548
2549 this._updateElementStyleClasses();
2550 },
2551
2552 /** 2564 /**
2553 * @return {boolean} 2565 * @return {boolean}
2554 */ 2566 */
2555 _isFailed: function() 2567 _isFailed: function()
2556 { 2568 {
2557 return !!this._request.failed || (this._request.statusCode >= 400); 2569 return !!this._request.failed || (this._request.statusCode >= 400);
2558 }, 2570 },
2559 2571
2560 _updateElementStyleClasses: function() 2572 /**
2573 * @param cell {!Element}
2574 */
2575 _renderNameCell: function(cell)
2561 { 2576 {
2562 var element = this._element; 2577 this._nameCell = cell;
2563 element.classList.toggle("network-error-row", this._isFailed()); 2578 cell.addEventListener("click", this._onClick.bind(this), false);
2564 element.classList.toggle("resource-cached", this._request.cached); 2579 cell.addEventListener("dblclick", this._openInNewTab.bind(this), false);
2565 var typeClassName = "network-type-" + this._request.type.name();
2566 if (!element.classList.contains(typeClassName)) {
2567 element.removeMatchingStyleClasses("network-type-\\w+");
2568 element.classList.add(typeClassName);
2569 }
2570 },
2571
2572 _refreshResponseHeaderCell: function(headerName)
2573 {
2574 var cell = this._responseHeaderCells[headerName];
2575 var value = this._request.responseHeaderValue(headerName);
2576 cell.setTextAndTitle(value ? value : "");
2577 },
2578
2579 _refreshNameCell: function()
2580 {
2581 this._nameCell.removeChildren();
2582 2580
2583 if (this._request.type === WebInspector.resourceTypes.Image) { 2581 if (this._request.type === WebInspector.resourceTypes.Image) {
2584 var previewImage = document.createElement("img"); 2582 var previewImage = document.createElement("img");
2585 previewImage.className = "image-network-icon-preview"; 2583 previewImage.className = "image-network-icon-preview";
2586 this._request.populateImageSource(previewImage); 2584 this._request.populateImageSource(previewImage);
2587 2585
2588 var iconElement = document.createElement("div"); 2586 var iconElement = document.createElement("div");
2589 iconElement.className = "icon"; 2587 iconElement.className = "icon";
2590 iconElement.appendChild(previewImage); 2588 iconElement.appendChild(previewImage);
2591 } else { 2589 } else {
2592 var iconElement = document.createElement("img"); 2590 var iconElement = document.createElement("img");
2593 iconElement.className = "icon"; 2591 iconElement.className = "icon";
2594 } 2592 }
2595 this._nameCell.appendChild(iconElement); 2593 cell.appendChild(iconElement);
2596 this._nameCell.appendChild(document.createTextNode(this._request.name()) ); 2594 cell.appendChild(document.createTextNode(this._request.name()));
2597 this._appendSubtitle(this._nameCell, this._request.path()); 2595 this._appendSubtitle(cell, this._request.path());
2598 this._nameCell.title = this._request.url; 2596 cell.title = this._request.url;
2599 }, 2597 },
2600 2598
2601 _refreshMethodCell: function() 2599 /**
2600 * @param cell {!Element}
2601 */
2602 _renderStatusCell: function(cell)
2602 { 2603 {
2603 this._methodCell.setTextAndTitle(this._request.requestMethod); 2604 cell.classList.toggle("network-dim-cell", !this._isFailed() && (this._re quest.cached || !this._request.statusCode));
2604 },
2605
2606 _refreshStatusCell: function()
2607 {
2608 this._statusCell.removeChildren();
2609 this._statusCell.classList.toggle("network-dim-cell", !this._isFailed() && (this._request.cached || !this._request.statusCode));
2610 2605
2611 if (this._request.failed && !this._request.canceled) { 2606 if (this._request.failed && !this._request.canceled) {
2612 var failText = WebInspector.UIString("(failed)"); 2607 var failText = WebInspector.UIString("(failed)");
2613 if (this._request.localizedFailDescription) { 2608 if (this._request.localizedFailDescription) {
2614 this._statusCell.appendChild(document.createTextNode(failText)); 2609 cell.appendChild(document.createTextNode(failText));
2615 this._appendSubtitle(this._statusCell, this._request.localizedFa ilDescription); 2610 this._appendSubtitle(cell, this._request.localizedFailDescriptio n);
2616 this._statusCell.title = failText + " " + this._request.localize dFailDescription; 2611 cell.title = failText + " " + this._request.localizedFailDescrip tion;
2617 } else 2612 } else
2618 this._statusCell.setTextAndTitle(failText); 2613 cell.setTextAndTitle(failText);
2619 } else if (this._request.statusCode) { 2614 } else if (this._request.statusCode) {
2620 this._statusCell.appendChild(document.createTextNode("" + this._requ est.statusCode)); 2615 cell.appendChild(document.createTextNode("" + this._request.statusCo de));
2621 this._appendSubtitle(this._statusCell, this._request.statusText); 2616 this._appendSubtitle(cell, this._request.statusText);
2622 this._statusCell.title = this._request.statusCode + " " + this._requ est.statusText; 2617 cell.title = this._request.statusCode + " " + this._request.statusTe xt;
2623 } else if (this._request.parsedURL.isDataURL()) { 2618 } else if (this._request.parsedURL.isDataURL()) {
2624 this._statusCell.setTextAndTitle(WebInspector.UIString("(data)")); 2619 cell.setTextAndTitle(WebInspector.UIString("(data)"));
2625 } else if (this._request.isPingRequest()) { 2620 } else if (this._request.isPingRequest()) {
2626 this._statusCell.setTextAndTitle(WebInspector.UIString("(ping)")); 2621 cell.setTextAndTitle(WebInspector.UIString("(ping)"));
2627 } else if (this._request.canceled) { 2622 } else if (this._request.canceled) {
2628 this._statusCell.setTextAndTitle(WebInspector.UIString("(canceled)") ); 2623 cell.setTextAndTitle(WebInspector.UIString("(canceled)"));
2629 } else if (this._request.finished) { 2624 } else if (this._request.finished) {
2630 this._statusCell.setTextAndTitle(WebInspector.UIString("Finished")); 2625 cell.setTextAndTitle(WebInspector.UIString("Finished"));
2631 } else { 2626 } else {
2632 this._statusCell.setTextAndTitle(WebInspector.UIString("(pending)")) ; 2627 cell.setTextAndTitle(WebInspector.UIString("(pending)"));
2633 } 2628 }
2634 }, 2629 },
2635 2630
2636 _refreshSchemeCell: function() 2631 /**
2637 { 2632 * @param cell {!Element}
2638 this._schemeCell.setTextAndTitle(this._request.scheme); 2633 */
2639 }, 2634 _renderTypeCell: function(cell)
2640
2641 _refreshDomainCell: function()
2642 {
2643 this._domainCell.setTextAndTitle(this._request.domain);
2644 },
2645
2646 _refreshRemoteAddressCell: function()
2647 {
2648 this._remoteAddressCell.setTextAndTitle(this._request.remoteAddress());
2649 },
2650
2651 _refreshTypeCell: function()
2652 { 2635 {
2653 if (this._request.mimeType) { 2636 if (this._request.mimeType) {
2654 this._typeCell.classList.remove("network-dim-cell"); 2637 cell.setTextAndTitle(this._request.mimeType);
2655 this._typeCell.setTextAndTitle(this._request.mimeType);
2656 } else { 2638 } else {
2657 this._typeCell.classList.toggle("network-dim-cell", !this._request.i sPingRequest()); 2639 cell.classList.toggle("network-dim-cell", !this._request.isPingReque st());
2658 this._typeCell.setTextAndTitle(this._request.requestContentType() || ""); 2640 cell.setTextAndTitle(this._request.requestContentType() || "");
2659 } 2641 }
2660 }, 2642 },
2661 2643
2662 _refreshInitiatorCell: function() 2644 /**
2645 * @param cell {!Element}
2646 */
2647 _renderInitiatorCell: function(cell)
2663 { 2648 {
2664 this._initiatorCell.removeChildren();
2665 this._initiatorCell.classList.remove("network-dim-cell");
2666 this._initiatorCell.classList.remove("network-script-initiated");
2667 delete this._initiatorCell.request;
2668
2669 var request = this._request; 2649 var request = this._request;
2670 var initiator = request.initiatorInfo(); 2650 var initiator = request.initiatorInfo();
2671 2651
2672 switch (initiator.type) { 2652 switch (initiator.type) {
2673 case WebInspector.NetworkRequest.InitiatorType.Parser: 2653 case WebInspector.NetworkRequest.InitiatorType.Parser:
2674 this._initiatorCell.title = initiator.url + ":" + initiator.lineNumb er; 2654 cell.title = initiator.url + ":" + initiator.lineNumber;
2675 this._initiatorCell.appendChild(WebInspector.linkifyResourceAsNode(i nitiator.url, initiator.lineNumber - 1)); 2655 cell.appendChild(WebInspector.linkifyResourceAsNode(initiator.url, i nitiator.lineNumber - 1));
2676 this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Par ser")); 2656 this._appendSubtitle(cell, WebInspector.UIString("Parser"));
2677 break; 2657 break;
2678 2658
2679 case WebInspector.NetworkRequest.InitiatorType.Redirect: 2659 case WebInspector.NetworkRequest.InitiatorType.Redirect:
2680 this._initiatorCell.title = initiator.url; 2660 cell.title = initiator.url;
2681 console.assert(request.redirectSource); 2661 console.assert(request.redirectSource);
2682 var redirectSource = /** @type {!WebInspector.NetworkRequest} */ (re quest.redirectSource); 2662 var redirectSource = /** @type {!WebInspector.NetworkRequest} */ (re quest.redirectSource);
2683 this._initiatorCell.appendChild(WebInspector.linkifyRequestAsNode(re directSource)); 2663 cell.appendChild(WebInspector.linkifyRequestAsNode(redirectSource));
2684 this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Red irect")); 2664 this._appendSubtitle(cell, WebInspector.UIString("Redirect"));
2685 break; 2665 break;
2686 2666
2687 case WebInspector.NetworkRequest.InitiatorType.Script: 2667 case WebInspector.NetworkRequest.InitiatorType.Script:
2688 var urlElement = this._linkifier.linkifyLocation(request.target(), i nitiator.url, initiator.lineNumber - 1, initiator.columnNumber - 1); 2668 var urlElement = this._linkifier.linkifyLocation(request.target(), i nitiator.url, initiator.lineNumber - 1, initiator.columnNumber - 1);
2689 urlElement.title = ""; 2669 urlElement.title = "";
2690 this._initiatorCell.appendChild(urlElement); 2670 cell.appendChild(urlElement);
2691 this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Scr ipt")); 2671 this._appendSubtitle(cell, WebInspector.UIString("Script"));
2692 this._initiatorCell.classList.add("network-script-initiated"); 2672 cell.classList.add("network-script-initiated");
2693 this._initiatorCell.request = request; 2673 cell.request = request;
2694 break; 2674 break;
2695 2675
2696 default: 2676 default:
2697 this._initiatorCell.title = ""; 2677 cell.title = "";
2698 this._initiatorCell.classList.add("network-dim-cell"); 2678 cell.classList.add("network-dim-cell");
2699 this._initiatorCell.setTextAndTitle(WebInspector.UIString("Other")); 2679 cell.setTextAndTitle(WebInspector.UIString("Other"));
2700 } 2680 }
2701 }, 2681 },
2702 2682
2703 _refreshCookiesCell: function() 2683 /**
2704 { 2684 * @param cell {!Element}
alph 2014/05/28 15:25:58 Here and elsewhere: @param {!Element} cell
eustas 2014/05/29 13:09:46 Done.
2705 var requestCookies = this._request.requestCookies; 2685 */
2706 this._cookiesCell.setTextAndTitle(requestCookies ? "" + requestCookies.l ength : ""); 2686 _renderSizeCell: function(cell)
2707 },
2708
2709 _refreshSetCookiesCell: function()
2710 {
2711 var responseCookies = this._request.responseCookies;
2712 this._setCookiesCell.setTextAndTitle(responseCookies ? "" + responseCook ies.length : "");
2713 },
2714
2715 _refreshSizeCell: function()
2716 { 2687 {
2717 if (this._request.cached) { 2688 if (this._request.cached) {
2718 this._sizeCell.setTextAndTitle(WebInspector.UIString("(from cache)") ); 2689 cell.setTextAndTitle(WebInspector.UIString("(from cache)"));
2719 this._sizeCell.classList.add("network-dim-cell"); 2690 cell.classList.add("network-dim-cell");
2720 } else { 2691 } else {
2721 var resourceSize = Number.bytesToString(this._request.resourceSize); 2692 var resourceSize = Number.bytesToString(this._request.resourceSize);
2722 var transferSize = Number.bytesToString(this._request.transferSize); 2693 var transferSize = Number.bytesToString(this._request.transferSize);
2723 this._sizeCell.setTextAndTitle(transferSize); 2694 cell.setTextAndTitle(transferSize);
2724 this._sizeCell.classList.remove("network-dim-cell"); 2695 this._appendSubtitle(cell, resourceSize);
2725 this._appendSubtitle(this._sizeCell, resourceSize);
2726 } 2696 }
2727 }, 2697 },
2728 2698
2729 _refreshTimeCell: function() 2699 /**
2700 * @param cell {!Element}
2701 */
2702 _renderTimeCell: function(cell)
2730 { 2703 {
2731 if (this._request.duration > 0) { 2704 if (this._request.duration > 0) {
2732 this._timeCell.classList.remove("network-dim-cell"); 2705 cell.setTextAndTitle(Number.secondsToString(this._request.duration)) ;
2733 this._timeCell.setTextAndTitle(Number.secondsToString(this._request. duration)); 2706 this._appendSubtitle(cell, Number.secondsToString(this._request.late ncy));
2734 this._appendSubtitle(this._timeCell, Number.secondsToString(this._re quest.latency));
2735 } else { 2707 } else {
2736 this._timeCell.classList.add("network-dim-cell"); 2708 cell.classList.add("network-dim-cell");
2737 this._timeCell.setTextAndTitle(WebInspector.UIString("Pending")); 2709 cell.setTextAndTitle(WebInspector.UIString("Pending"));
2738 } 2710 }
2739 }, 2711 },
2740 2712
2741 _appendSubtitle: function(cellElement, subtitleText) 2713 _appendSubtitle: function(cellElement, subtitleText)
2742 { 2714 {
2743 var subtitleElement = document.createElement("div"); 2715 var subtitleElement = document.createElement("div");
2744 subtitleElement.className = "network-cell-subtitle"; 2716 subtitleElement.className = "network-cell-subtitle";
2745 subtitleElement.textContent = subtitleText; 2717 subtitleElement.textContent = subtitleText;
2746 cellElement.appendChild(subtitleElement); 2718 cellElement.appendChild(subtitleElement);
2747 }, 2719 },
2748 2720
2749 refreshGraph: function(calculator) 2721 refreshGraph: function(calculator)
2750 { 2722 {
2723 if (!this._timelineCell)
2724 return;
2725
2751 var percentages = calculator.computeBarGraphPercentages(this._request); 2726 var percentages = calculator.computeBarGraphPercentages(this._request);
2752 this._percentages = percentages; 2727 this._percentages = percentages;
2753 2728
2754 this._barAreaElement.classList.remove("hidden"); 2729 this._barAreaElement.classList.remove("hidden");
2755 2730
2756 this._barLeftElement.style.setProperty("left", percentages.start + "%"); 2731 this._barLeftElement.style.setProperty("left", percentages.start + "%");
2757 this._barRightElement.style.setProperty("right", (100 - percentages.end) + "%"); 2732 this._barRightElement.style.setProperty("right", (100 - percentages.end) + "%");
2758 2733
2759 this._barLeftElement.style.setProperty("right", (100 - percentages.end) + "%"); 2734 this._barLeftElement.style.setProperty("right", (100 - percentages.end) + "%");
2760 this._barRightElement.style.setProperty("left", percentages.middle + "%" ); 2735 this._barRightElement.style.setProperty("left", percentages.middle + "%" );
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
2918 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b) 2893 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b)
2919 { 2894 {
2920 var aValue = a._request[propertyName]; 2895 var aValue = a._request[propertyName];
2921 var bValue = b._request[propertyName]; 2896 var bValue = b._request[propertyName];
2922 if (aValue > bValue) 2897 if (aValue > bValue)
2923 return revert ? -1 : 1; 2898 return revert ? -1 : 1;
2924 if (bValue > aValue) 2899 if (bValue > aValue)
2925 return revert ? 1 : -1; 2900 return revert ? 1 : -1;
2926 return 0; 2901 return 0;
2927 } 2902 }
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/ui/DataGrid.js » ('j') | Source/devtools/front_end/ui/DataGrid.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698