OLD | NEW |
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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 this._summaryBarElement = this.element.createChild("div", "network-summa
ry-bar"); | 184 this._summaryBarElement = this.element.createChild("div", "network-summa
ry-bar"); |
185 | 185 |
186 this._updateRowsSize(); | 186 this._updateRowsSize(); |
187 | 187 |
188 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this.
_getPopoverAnchor.bind(this), this._showPopover.bind(this), this._onHidePopover.
bind(this)); | 188 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this.
_getPopoverAnchor.bind(this), this._showPopover.bind(this), this._onHidePopover.
bind(this)); |
189 // Enable faster hint. | 189 // Enable faster hint. |
190 this._popoverHelper.setTimeout(100); | 190 this._popoverHelper.setTimeout(100); |
191 | 191 |
192 this._setCalculator(new WebInspector.NetworkTransferTimeCalculator()); | 192 this._setCalculator(new WebInspector.NetworkTransferTimeCalculator()); |
193 | 193 |
194 this.switchToDetailedView(); | 194 this.switchViewMode(true); |
195 }, | 195 }, |
196 | 196 |
197 /** | 197 /** |
198 * @return {!Array.<!Element>} | 198 * @return {!Array.<!Element>} |
199 */ | 199 */ |
200 statusBarItems: function() | 200 statusBarItems: function() |
201 { | 201 { |
202 return [ | 202 return [ |
203 this._recordButton.element, | 203 this._recordButton.element, |
204 this._clearButton.element, | 204 this._clearButton.element, |
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 if (request.loaderId === loaderId) | 927 if (request.loaderId === loaderId) |
928 requestsToPick.push(request); | 928 requestsToPick.push(request); |
929 } | 929 } |
930 | 930 |
931 this._reset(); | 931 this._reset(); |
932 | 932 |
933 for (var i = 0; i < requestsToPick.length; ++i) | 933 for (var i = 0; i < requestsToPick.length; ++i) |
934 this._appendRequest(requestsToPick[i]); | 934 this._appendRequest(requestsToPick[i]); |
935 }, | 935 }, |
936 | 936 |
937 switchToDetailedView: function() | 937 /** |
| 938 * @param {boolean} detailed |
| 939 */ |
| 940 switchViewMode: function(detailed) |
938 { | 941 { |
939 if (!this._dataGrid) | 942 if (this._detailedMode === detailed) |
940 return; | 943 return; |
941 if (this._dataGrid.selectedNode) | 944 this._detailedMode = detailed; |
942 this._dataGrid.selectedNode.selected = false; | |
943 | 945 |
944 this.element.classList.remove("brief-mode"); | 946 if (detailed) { |
945 this._detailedMode = true; | 947 if (this._dataGrid.selectedNode) |
| 948 this._dataGrid.selectedNode.selected = false; |
| 949 } else { |
| 950 this._removeAllNodeHighlights(); |
| 951 this._popoverHelper.hidePopover(); |
| 952 } |
| 953 |
| 954 this.element.classList.toggle("brief-mode", !detailed); |
946 this._updateColumns(); | 955 this._updateColumns(); |
947 }, | 956 }, |
948 | 957 |
949 switchToBriefView: function() | |
950 { | |
951 this.element.classList.add("brief-mode"); | |
952 this._removeAllNodeHighlights(); | |
953 this._detailedMode = false; | |
954 this._updateColumns(); | |
955 this._popoverHelper.hidePopover(); | |
956 }, | |
957 | |
958 _toggleLargerRequests: function() | 958 _toggleLargerRequests: function() |
959 { | 959 { |
960 WebInspector.settings.resourcesLargeRows.set(!WebInspector.settings.reso
urcesLargeRows.get()); | 960 WebInspector.settings.resourcesLargeRows.set(!WebInspector.settings.reso
urcesLargeRows.get()); |
961 this._updateRowsSize(); | 961 this._updateRowsSize(); |
962 }, | 962 }, |
963 | 963 |
964 /** | 964 /** |
965 * @return {number} | 965 * @return {number} |
966 */ | 966 */ |
967 rowHeight: function() | 967 rowHeight: function() |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 this._currentMatchedRequestNode = null; | 1321 this._currentMatchedRequestNode = null; |
1322 return; | 1322 return; |
1323 } | 1323 } |
1324 | 1324 |
1325 var request = node._request; | 1325 var request = node._request; |
1326 var regExp = this._searchRegExp; | 1326 var regExp = this._searchRegExp; |
1327 var nameMatched = request.name().match(regExp); | 1327 var nameMatched = request.name().match(regExp); |
1328 var pathMatched = request.path().match(regExp); | 1328 var pathMatched = request.path().match(regExp); |
1329 if (!nameMatched && pathMatched && !this._largerRequestsButton.toggled) | 1329 if (!nameMatched && pathMatched && !this._largerRequestsButton.toggled) |
1330 this._toggleLargerRequests(); | 1330 this._toggleLargerRequests(); |
| 1331 if (reveal) |
| 1332 WebInspector.Revealer.reveal(request); |
1331 var highlightedSubstringChanges = node._highlightMatchedSubstring(regExp
); | 1333 var highlightedSubstringChanges = node._highlightMatchedSubstring(regExp
); |
1332 this._highlightedSubstringChanges.push(highlightedSubstringChanges); | 1334 this._highlightedSubstringChanges.push(highlightedSubstringChanges); |
1333 if (reveal) | |
1334 WebInspector.Revealer.reveal(node); | |
1335 | 1335 |
1336 this._currentMatchedRequestNode = node; | 1336 this._currentMatchedRequestNode = node; |
1337 this._currentMatchedRequestIndex = n; | 1337 this._currentMatchedRequestIndex = n; |
1338 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Sea
rchIndexUpdated, n); | 1338 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Sea
rchIndexUpdated, n); |
1339 }, | 1339 }, |
1340 | 1340 |
1341 /** | 1341 /** |
1342 * @param {string} query | 1342 * @param {string} query |
1343 * @param {boolean} shouldJump | 1343 * @param {boolean} shouldJump |
1344 * @param {boolean=} jumpBackwards | 1344 * @param {boolean=} jumpBackwards |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1499 | 1499 |
1500 /** | 1500 /** |
1501 * @param {!WebInspector.NetworkRequest} request | 1501 * @param {!WebInspector.NetworkRequest} request |
1502 */ | 1502 */ |
1503 revealAndHighlightRequest: function(request) | 1503 revealAndHighlightRequest: function(request) |
1504 { | 1504 { |
1505 this._removeAllNodeHighlights(); | 1505 this._removeAllNodeHighlights(); |
1506 | 1506 |
1507 var node = this._nodesByRequestId.get(request.requestId); | 1507 var node = this._nodesByRequestId.get(request.requestId); |
1508 if (node) { | 1508 if (node) { |
1509 this._dataGrid.element.focus(); | |
1510 node.reveal(); | 1509 node.reveal(); |
1511 this._highlightNode(node); | 1510 this._highlightNode(node); |
1512 } | 1511 } |
1513 }, | 1512 }, |
1514 | 1513 |
1515 _removeAllNodeHighlights: function() | 1514 _removeAllNodeHighlights: function() |
1516 { | 1515 { |
1517 if (this._highlightedNode) { | 1516 if (this._highlightedNode) { |
1518 this._highlightedNode.element().classList.remove("highlighted-row"); | 1517 this._highlightedNode.element().classList.remove("highlighted-row"); |
1519 delete this._highlightedNode; | 1518 delete this._highlightedNode; |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1998 }, | 1997 }, |
1999 | 1998 |
2000 _toggleGridMode: function() | 1999 _toggleGridMode: function() |
2001 { | 2000 { |
2002 if (this._viewingRequestMode) { | 2001 if (this._viewingRequestMode) { |
2003 this._viewingRequestMode = false; | 2002 this._viewingRequestMode = false; |
2004 this.element.classList.remove("viewing-resource"); | 2003 this.element.classList.remove("viewing-resource"); |
2005 this._splitView.hideMain(); | 2004 this._splitView.hideMain(); |
2006 } | 2005 } |
2007 | 2006 |
2008 this._networkLogView.switchToDetailedView(); | 2007 this._networkLogView.switchViewMode(true); |
2009 this._networkLogView.setAllowPopover(true); | 2008 this._networkLogView.setAllowPopover(true); |
2010 this._networkLogView._allowRequestSelection = false; | 2009 this._networkLogView._allowRequestSelection = false; |
2011 }, | 2010 }, |
2012 | 2011 |
2013 _toggleViewingRequestMode: function() | 2012 _toggleViewingRequestMode: function() |
2014 { | 2013 { |
2015 if (this._viewingRequestMode) | 2014 if (this._viewingRequestMode) |
2016 return; | 2015 return; |
2017 this._viewingRequestMode = true; | 2016 this._viewingRequestMode = true; |
2018 | 2017 |
2019 this.element.classList.add("viewing-resource"); | 2018 this.element.classList.add("viewing-resource"); |
2020 this._splitView.showBoth(); | 2019 this._splitView.showBoth(); |
2021 this._networkLogView.setAllowPopover(false); | 2020 this._networkLogView.setAllowPopover(false); |
2022 this._networkLogView._allowRequestSelection = true; | 2021 this._networkLogView._allowRequestSelection = true; |
2023 this._networkLogView.switchToBriefView(); | 2022 this._networkLogView.switchViewMode(false); |
2024 }, | 2023 }, |
2025 | 2024 |
2026 /** | 2025 /** |
2027 * @param {string} query | 2026 * @param {string} query |
2028 * @param {boolean} shouldJump | 2027 * @param {boolean} shouldJump |
2029 * @param {boolean=} jumpBackwards | 2028 * @param {boolean=} jumpBackwards |
2030 */ | 2029 */ |
2031 performSearch: function(query, shouldJump, jumpBackwards) | 2030 performSearch: function(query, shouldJump, jumpBackwards) |
2032 { | 2031 { |
2033 this._networkLogView.performSearch(query, shouldJump, jumpBackwards); | 2032 this._networkLogView.performSearch(query, shouldJump, jumpBackwards); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2124 * @constructor | 2123 * @constructor |
2125 * @implements {WebInspector.Revealer} | 2124 * @implements {WebInspector.Revealer} |
2126 */ | 2125 */ |
2127 WebInspector.NetworkPanel.RequestRevealer = function() | 2126 WebInspector.NetworkPanel.RequestRevealer = function() |
2128 { | 2127 { |
2129 } | 2128 } |
2130 | 2129 |
2131 WebInspector.NetworkPanel.RequestRevealer.prototype = { | 2130 WebInspector.NetworkPanel.RequestRevealer.prototype = { |
2132 /** | 2131 /** |
2133 * @param {!Object} request | 2132 * @param {!Object} request |
| 2133 * @param {number=} lineNumber |
2134 */ | 2134 */ |
2135 reveal: function(request) | 2135 reveal: function(request, lineNumber) |
2136 { | 2136 { |
2137 if (request instanceof WebInspector.NetworkRequest) { | 2137 if (request instanceof WebInspector.NetworkRequest) { |
2138 var panel = /** @type {?WebInspector.NetworkPanel} */ (WebInspector.
inspectorView.showPanel("network")); | 2138 var panel = /** @type {?WebInspector.NetworkPanel} */ (WebInspector.
inspectorView.showPanel("network")); |
2139 if (panel) | 2139 if (panel) |
2140 panel.revealAndHighlightRequest(request); | 2140 panel.revealAndHighlightRequest(request); |
2141 } | 2141 } |
2142 } | 2142 } |
2143 } | 2143 } |
2144 | 2144 |
2145 /** | 2145 /** |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2588 action: WebInspector.UserMetrics.UserActionNames.NetworkRequestSelec
ted, | 2588 action: WebInspector.UserMetrics.UserActionNames.NetworkRequestSelec
ted, |
2589 url: this._request.url | 2589 url: this._request.url |
2590 }); | 2590 }); |
2591 }, | 2591 }, |
2592 | 2592 |
2593 /** | 2593 /** |
2594 * @param {!RegExp=} regexp | 2594 * @param {!RegExp=} regexp |
2595 */ | 2595 */ |
2596 _highlightMatchedSubstring: function(regexp) | 2596 _highlightMatchedSubstring: function(regexp) |
2597 { | 2597 { |
| 2598 // Ensure element is created. |
| 2599 this.element(); |
2598 var domChanges = []; | 2600 var domChanges = []; |
2599 var matchInfo = this._element.textContent.match(regexp); | 2601 var matchInfo = this._nameCell.textContent.match(regexp); |
2600 if (matchInfo) | 2602 if (matchInfo) |
2601 WebInspector.highlightSearchResult(this._nameCell, matchInfo.index,
matchInfo[0].length, domChanges); | 2603 WebInspector.highlightSearchResult(this._nameCell, matchInfo.index,
matchInfo[0].length, domChanges); |
2602 return domChanges; | 2604 return domChanges; |
2603 }, | 2605 }, |
2604 | 2606 |
2605 _openInNewTab: function() | 2607 _openInNewTab: function() |
2606 { | 2608 { |
2607 InspectorFrontendHost.openInNewTab(this._request.url); | 2609 InspectorFrontendHost.openInNewTab(this._request.url); |
2608 }, | 2610 }, |
2609 | 2611 |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3025 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa
me, revert, a, b) | 3027 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa
me, revert, a, b) |
3026 { | 3028 { |
3027 var aValue = a._request[propertyName]; | 3029 var aValue = a._request[propertyName]; |
3028 var bValue = b._request[propertyName]; | 3030 var bValue = b._request[propertyName]; |
3029 if (aValue > bValue) | 3031 if (aValue > bValue) |
3030 return revert ? -1 : 1; | 3032 return revert ? -1 : 1; |
3031 if (bValue > aValue) | 3033 if (bValue > aValue) |
3032 return revert ? 1 : -1; | 3034 return revert ? 1 : -1; |
3033 return a._request.indentityCompare(b._request); | 3035 return a._request.indentityCompare(b._request); |
3034 } | 3036 } |
OLD | NEW |