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

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

Issue 182113004: DevTools: Get rid of Element.prototype.enableStyleClass (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebaselined Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/devtools/front_end/Layers3DView.js ('k') | Source/devtools/front_end/OverridesView.js » ('j') | 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) 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 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 if (dataGridNode.isFilteredOut()) { 1167 if (dataGridNode.isFilteredOut()) {
1168 row.classList.remove("offscreen"); 1168 row.classList.remove("offscreen");
1169 continue; 1169 continue;
1170 } 1170 }
1171 1171
1172 if (!rowHeight) 1172 if (!rowHeight)
1173 rowHeight = row.offsetHeight; 1173 rowHeight = row.offsetHeight;
1174 1174
1175 var rowIsVisible = unfilteredRowIndex * rowHeight < visibleBottom && (unfilteredRowIndex + 1) * rowHeight > visibleTop; 1175 var rowIsVisible = unfilteredRowIndex * rowHeight < visibleBottom && (unfilteredRowIndex + 1) * rowHeight > visibleTop;
1176 if (rowIsVisible !== row.rowIsVisible) { 1176 if (rowIsVisible !== row.rowIsVisible) {
1177 row.enableStyleClass("offscreen", !rowIsVisible); 1177 row.classList.toggle("offscreen", !rowIsVisible);
1178 row.rowIsVisible = rowIsVisible; 1178 row.rowIsVisible = rowIsVisible;
1179 } 1179 }
1180 var rowIsOdd = !!(unfilteredRowIndex & 1); 1180 var rowIsOdd = !!(unfilteredRowIndex & 1);
1181 if (rowIsOdd !== row.rowIsOdd) { 1181 if (rowIsOdd !== row.rowIsOdd) {
1182 row.enableStyleClass("odd", rowIsOdd); 1182 row.classList.toggle("odd", rowIsOdd);
1183 row.rowIsOdd = rowIsOdd; 1183 row.rowIsOdd = rowIsOdd;
1184 } 1184 }
1185 unfilteredRowIndex++; 1185 unfilteredRowIndex++;
1186 } 1186 }
1187 }, 1187 },
1188 1188
1189 _matchRequest: function(request) 1189 _matchRequest: function(request)
1190 { 1190 {
1191 if (!this._searchRegExp) 1191 if (!this._searchRegExp)
1192 return -1; 1192 return -1;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 */ 1320 */
1321 _applyFilter: function(node) 1321 _applyFilter: function(node)
1322 { 1322 {
1323 var request = node._request; 1323 var request = node._request;
1324 var matches = this._resourceTypeFilterUI.accept(request.type.name()); 1324 var matches = this._resourceTypeFilterUI.accept(request.type.name());
1325 if (this._dataURLFilterUI.checked() && request.parsedURL.isDataURL()) 1325 if (this._dataURLFilterUI.checked() && request.parsedURL.isDataURL())
1326 matches = false; 1326 matches = false;
1327 for (var i = 0; matches && (i < this._filters.length); ++i) 1327 for (var i = 0; matches && (i < this._filters.length); ++i)
1328 matches = this._filters[i](request); 1328 matches = this._filters[i](request);
1329 1329
1330 node.element.enableStyleClass("filtered-out", !matches); 1330 node.element.classList.toggle("filtered-out", !matches);
1331 if (matches) 1331 if (matches)
1332 this._filteredOutRequests.remove(request); 1332 this._filteredOutRequests.remove(request);
1333 else 1333 else
1334 this._filteredOutRequests.put(request, true); 1334 this._filteredOutRequests.put(request, true);
1335 }, 1335 },
1336 1336
1337 /** 1337 /**
1338 * @param {string} query 1338 * @param {string} query
1339 */ 1339 */
1340 _parseFilterQuery: function(query) 1340 _parseFilterQuery: function(query)
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1736 SetCookieValue: "SetCookieValue" 1736 SetCookieValue: "SetCookieValue"
1737 }; 1737 };
1738 1738
1739 /** @type {!Array.<string>} */ 1739 /** @type {!Array.<string>} */
1740 WebInspector.NetworkPanel._searchKeys = Object.values(WebInspector.NetworkPanel. FilterType); 1740 WebInspector.NetworkPanel._searchKeys = Object.values(WebInspector.NetworkPanel. FilterType);
1741 1741
1742 WebInspector.NetworkPanel.prototype = { 1742 WebInspector.NetworkPanel.prototype = {
1743 _onFiltersToggled: function(event) 1743 _onFiltersToggled: function(event)
1744 { 1744 {
1745 var toggled = /** @type {boolean} */ (event.data); 1745 var toggled = /** @type {boolean} */ (event.data);
1746 this._filtersContainer.enableStyleClass("hidden", !toggled); 1746 this._filtersContainer.classList.toggle("hidden", !toggled);
1747 this.element.enableStyleClass("filters-toggled", toggled); 1747 this.element.classList.toggle("filters-toggled", toggled);
1748 }, 1748 },
1749 1749
1750 /** 1750 /**
1751 * @return {!Array.<!Element>} 1751 * @return {!Array.<!Element>}
1752 */ 1752 */
1753 elementsToRestoreScrollPositionsFor: function() 1753 elementsToRestoreScrollPositionsFor: function()
1754 { 1754 {
1755 return this._networkLogView.elementsToRestoreScrollPositionsFor(); 1755 return this._networkLogView.elementsToRestoreScrollPositionsFor();
1756 }, 1756 },
1757 1757
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1803 _onViewCleared: function(event) 1803 _onViewCleared: function(event)
1804 { 1804 {
1805 this._closeVisibleRequest(); 1805 this._closeVisibleRequest();
1806 this._toggleGridMode(); 1806 this._toggleGridMode();
1807 this._viewsContainerElement.removeChildren(); 1807 this._viewsContainerElement.removeChildren();
1808 this._viewsContainerElement.appendChild(this._closeButtonElement); 1808 this._viewsContainerElement.appendChild(this._closeButtonElement);
1809 }, 1809 },
1810 1810
1811 _onRowSizeChanged: function(event) 1811 _onRowSizeChanged: function(event)
1812 { 1812 {
1813 this._viewsContainerElement.enableStyleClass("small", !event.data.largeR ows); 1813 this._viewsContainerElement.classList.toggle("small", !event.data.largeR ows);
1814 }, 1814 },
1815 1815
1816 _onSearchCountUpdated: function(event) 1816 _onSearchCountUpdated: function(event)
1817 { 1817 {
1818 this._searchableView.updateSearchMatchesCount(event.data); 1818 this._searchableView.updateSearchMatchesCount(event.data);
1819 }, 1819 },
1820 1820
1821 _onSearchIndexUpdated: function(event) 1821 _onSearchIndexUpdated: function(event)
1822 { 1822 {
1823 this._searchableView.updateCurrentMatchIndex(event.data); 1823 this._searchableView.updateCurrentMatchIndex(event.data);
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
2492 this._refreshTimeCell(); 2492 this._refreshTimeCell();
2493 2493
2494 var responseHeaderColumns = WebInspector.NetworkLogView._responseHeaderC olumns; 2494 var responseHeaderColumns = WebInspector.NetworkLogView._responseHeaderC olumns;
2495 for (var i = 0; i < responseHeaderColumns.length; ++i) 2495 for (var i = 0; i < responseHeaderColumns.length; ++i)
2496 this._refreshResponseHeaderCell(responseHeaderColumns[i]); 2496 this._refreshResponseHeaderCell(responseHeaderColumns[i]);
2497 2497
2498 if (this._request.cached) 2498 if (this._request.cached)
2499 this._timelineCell.classList.add("resource-cached"); 2499 this._timelineCell.classList.add("resource-cached");
2500 2500
2501 this._element.classList.add("network-item"); 2501 this._element.classList.add("network-item");
2502 this._element.enableStyleClass("network-error-row", this._isFailed()); 2502 this._element.classList.toggle("network-error-row", this._isFailed());
2503 this._updateElementStyleClasses(this._element); 2503 this._updateElementStyleClasses(this._element);
2504 }, 2504 },
2505 2505
2506 /** 2506 /**
2507 * @return {boolean} 2507 * @return {boolean}
2508 */ 2508 */
2509 _isFailed: function() 2509 _isFailed: function()
2510 { 2510 {
2511 return !!this._request.failed || (this._request.statusCode >= 400); 2511 return !!this._request.failed || (this._request.statusCode >= 400);
2512 }, 2512 },
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2553 }, 2553 },
2554 2554
2555 _refreshMethodCell: function() 2555 _refreshMethodCell: function()
2556 { 2556 {
2557 this._methodCell.setTextAndTitle(this._request.requestMethod); 2557 this._methodCell.setTextAndTitle(this._request.requestMethod);
2558 }, 2558 },
2559 2559
2560 _refreshStatusCell: function() 2560 _refreshStatusCell: function()
2561 { 2561 {
2562 this._statusCell.removeChildren(); 2562 this._statusCell.removeChildren();
2563 this._statusCell.enableStyleClass("network-dim-cell", !this._isFailed() && (this._request.cached || !this._request.statusCode)); 2563 this._statusCell.classList.toggle("network-dim-cell", !this._isFailed() && (this._request.cached || !this._request.statusCode));
2564 2564
2565 if (this._request.failed && !this._request.canceled) { 2565 if (this._request.failed && !this._request.canceled) {
2566 var failText = WebInspector.UIString("(failed)"); 2566 var failText = WebInspector.UIString("(failed)");
2567 if (this._request.localizedFailDescription) { 2567 if (this._request.localizedFailDescription) {
2568 this._statusCell.appendChild(document.createTextNode(failText)); 2568 this._statusCell.appendChild(document.createTextNode(failText));
2569 this._appendSubtitle(this._statusCell, this._request.localizedFa ilDescription); 2569 this._appendSubtitle(this._statusCell, this._request.localizedFa ilDescription);
2570 this._statusCell.title = failText + " " + this._request.localize dFailDescription; 2570 this._statusCell.title = failText + " " + this._request.localize dFailDescription;
2571 } else 2571 } else
2572 this._statusCell.setTextAndTitle(failText); 2572 this._statusCell.setTextAndTitle(failText);
2573 } else if (this._request.statusCode) { 2573 } else if (this._request.statusCode) {
(...skipping 27 matching lines...) Expand all
2601 { 2601 {
2602 this._remoteAddressCell.setTextAndTitle(this._request.remoteAddress()); 2602 this._remoteAddressCell.setTextAndTitle(this._request.remoteAddress());
2603 }, 2603 },
2604 2604
2605 _refreshTypeCell: function() 2605 _refreshTypeCell: function()
2606 { 2606 {
2607 if (this._request.mimeType) { 2607 if (this._request.mimeType) {
2608 this._typeCell.classList.remove("network-dim-cell"); 2608 this._typeCell.classList.remove("network-dim-cell");
2609 this._typeCell.setTextAndTitle(this._request.mimeType); 2609 this._typeCell.setTextAndTitle(this._request.mimeType);
2610 } else { 2610 } else {
2611 this._typeCell.enableStyleClass("network-dim-cell", !this._request.i sPingRequest()); 2611 this._typeCell.classList.toggle("network-dim-cell", !this._request.i sPingRequest());
2612 this._typeCell.setTextAndTitle(this._request.requestContentType() || ""); 2612 this._typeCell.setTextAndTitle(this._request.requestContentType() || "");
2613 } 2613 }
2614 }, 2614 },
2615 2615
2616 _refreshInitiatorCell: function() 2616 _refreshInitiatorCell: function()
2617 { 2617 {
2618 this._initiatorCell.removeChildren(); 2618 this._initiatorCell.removeChildren();
2619 this._initiatorCell.classList.remove("network-dim-cell"); 2619 this._initiatorCell.classList.remove("network-dim-cell");
2620 this._initiatorCell.classList.remove("network-script-initiated"); 2620 this._initiatorCell.classList.remove("network-script-initiated");
2621 delete this._initiatorCell.request; 2621 delete this._initiatorCell.request;
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
2873 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b) 2873 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b)
2874 { 2874 {
2875 var aValue = a._request[propertyName]; 2875 var aValue = a._request[propertyName];
2876 var bValue = b._request[propertyName]; 2876 var bValue = b._request[propertyName];
2877 if (aValue > bValue) 2877 if (aValue > bValue)
2878 return revert ? -1 : 1; 2878 return revert ? -1 : 1;
2879 if (bValue > aValue) 2879 if (bValue > aValue)
2880 return revert ? 1 : -1; 2880 return revert ? 1 : -1;
2881 return 0; 2881 return 0;
2882 } 2882 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/Layers3DView.js ('k') | Source/devtools/front_end/OverridesView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698