Changeset 72655 in webkit
- Timestamp:
- Nov 24, 2010 2:36:12 AM (13 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 4 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r72654 r72655 1 2010-11-22 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: refactor ResourceView hierarchy. 6 https://bugs.webkit.org/show_bug.cgi?id=49864 7 8 This refactoring splits ResourceView.js into: 9 NetworkItemView.js (tabbed pane) 10 ResourceHeadersView.js (header tab) 11 ResourceCookiesView.js (cookies tab) 12 ResourceView.js (base class for content tab). 13 CookiesTable was extracted from CookieItemsView and 14 brushed up. headersVisible flag has been removed. 15 16 * English.lproj/localizedStrings.js: 17 * WebCore.gypi: 18 * WebCore.vcproj/WebCore.vcproj: 19 * inspector/front-end/CookieItemsView.js: 20 (WebInspector.CookieItemsView): 21 (WebInspector.CookieItemsView.prototype.get statusBarItems): 22 (WebInspector.CookieItemsView.prototype.hide): 23 (WebInspector.CookieItemsView.prototype.resize): 24 (WebInspector.CookieItemsView.prototype._updateWithCookies): 25 (WebInspector.CookieItemsView.prototype._filterCookiesForDomain): 26 (WebInspector.CookieItemsView.prototype._deleteCookie): 27 (WebInspector.CookieItemsView.prototype._deleteButtonClicked): 28 (WebInspector.CookieItemsView.prototype._refreshButtonClicked): 29 (WebInspector.SimpleCookiesTable): 30 (WebInspector.SimpleCookiesTable.prototype.setCookies): 31 (WebInspector.SimpleCookiesTable.prototype.resize): 32 * inspector/front-end/CookiesTable.js: Added. 33 (WebInspector.CookiesTable): 34 (WebInspector.CookiesTable.prototype.updateWidths): 35 (WebInspector.CookiesTable.prototype.setCookies): 36 (WebInspector.CookiesTable.prototype.addCookiesFolder): 37 (WebInspector.CookiesTable.prototype.get selectedCookie): 38 (WebInspector.CookiesTable.prototype._rebuildTable): 39 (WebInspector.CookiesTable.prototype.reset): 40 (WebInspector.CookiesTable.prototype._populateNode): 41 (WebInspector.CookiesTable.prototype._totalSize): 42 (WebInspector.CookiesTable.prototype._sortCookies.localeCompare): 43 (WebInspector.CookiesTable.prototype._sortCookies.numberCompare): 44 (WebInspector.CookiesTable.prototype._sortCookies.expiresCompare): 45 (WebInspector.CookiesTable.prototype._sortCookies): 46 (WebInspector.CookiesTable.prototype._createGridNode): 47 (WebInspector.CookiesTable.prototype._onDeleteFromGrid): 48 * inspector/front-end/FileSystemView.js: 49 (WebInspector.FileSystemView.prototype._selectFileSystemTab): 50 (WebInspector.FileSystemView.prototype.selectTemporaryFileSystemTab): 51 * inspector/front-end/FontView.js: 52 (WebInspector.FontView.prototype.hasContent): 53 (WebInspector.FontView.prototype._createContentIfNeeded): 54 (WebInspector.FontView.prototype.show): 55 (WebInspector.FontView.prototype.updateFontPreviewSize): 56 * inspector/front-end/ImageView.js: 57 (WebInspector.ImageView.prototype.hasContent): 58 (WebInspector.ImageView.prototype.show): 59 * inspector/front-end/NetworkItemView.js: Added. 60 (WebInspector.NetworkItemView): 61 (WebInspector.NetworkItemView.prototype.show): 62 (WebInspector.NetworkItemView.prototype._selectTab): 63 (WebInspector.NetworkItemView.prototype._tabSelected): 64 (WebInspector.NetworkItemView.prototype.resize): 65 (WebInspector.NetworkItemView.prototype.selectContentTab): 66 * inspector/front-end/NetworkPanel.js: 67 (WebInspector.NetworkPanel.prototype.show): 68 (WebInspector.NetworkPanel.prototype.refreshResource): 69 (WebInspector.NetworkPanel.prototype._showResource): 70 (WebInspector.NetworkPanel.prototype._closeVisibleResource): 71 * inspector/front-end/ResourceCookiesView.js: Added. 72 (WebInspector.ResourceCookiesView): 73 (WebInspector.ResourceCookiesView.prototype.show): 74 * inspector/front-end/ResourceHeadersView.js: Added. 75 (WebInspector.ResourceHeadersView): 76 (WebInspector.ResourceHeadersView.prototype._refreshURL): 77 (WebInspector.ResourceHeadersView.prototype._refreshQueryString): 78 (WebInspector.ResourceHeadersView.prototype._refreshFormData): 79 (WebInspector.ResourceHeadersView.prototype._refreshRequestPayload): 80 (WebInspector.ResourceHeadersView.prototype._refreshParms): 81 (WebInspector.ResourceHeadersView.prototype._toggleURLdecoding): 82 (WebInspector.ResourceHeadersView.prototype._getHeaderValue): 83 (WebInspector.ResourceHeadersView.prototype._refreshRequestHeaders): 84 (WebInspector.ResourceHeadersView.prototype._refreshResponseHeaders): 85 (WebInspector.ResourceHeadersView.prototype._refreshHTTPInformation): 86 (WebInspector.ResourceHeadersView.prototype._refreshHeaders): 87 * inspector/front-end/ResourceView.js: 88 (WebInspector.ResourceView): 89 (WebInspector.ResourceView.prototype.hasContent): 90 * inspector/front-end/ResourcesPanel.js: 91 (WebInspector.ResourcesPanel.prototype.show): 92 (WebInspector.ResourcesPanel.prototype.showResource): 93 (WebInspector.ResourcesPanel.prototype._showResourceView): 94 * inspector/front-end/ScriptsPanel.js: 95 (WebInspector.ScriptsPanel.prototype.show): 96 (WebInspector.ScriptsPanel.prototype._showScriptOrResource): 97 * inspector/front-end/SourceView.js: 98 (WebInspector.SourceView): 99 (WebInspector.SourceView.prototype.show): 100 (WebInspector.SourceView.prototype.hide): 101 (WebInspector.SourceView.prototype.resize): 102 (WebInspector.SourceView.prototype.setupSourceFrameIfNeeded): 103 (WebInspector.SourceView.prototype.hasContent): 104 (WebInspector.SourceView.prototype.updateLocalContent): 105 (WebInspector.SourceView.prototype.selectLocalContentTab): 106 * inspector/front-end/StylesSidebarPane.js: 107 * inspector/front-end/TabbedPane.js: 108 (WebInspector.TabbedPane): 109 (WebInspector.TabbedPane.prototype.appendTab): 110 (WebInspector.TabbedPane.prototype.selectTab): 111 (WebInspector.TabbedPane.prototype._showTab): 112 (WebInspector.TabbedPane.prototype._hideTab): 113 * inspector/front-end/WebKit.qrc: 114 * inspector/front-end/inspector.css: 115 (.webkit-line-gutter-backdrop): 116 (.resource-view): 117 (.resource-view.visible): 118 (.resource-view.font): 119 (.resource-view.image > .image): 120 (.resource-view.image > .info): 121 (.storage-view): 122 (.storage-view .data-grid): 123 (.storage-empty-view, .storage-view .storage-table-error): 124 (.storage-view .storage-table-error): 125 * inspector/front-end/inspector.html: 126 * inspector/front-end/networkPanel.css: 127 (.network-cell-subtitle): 128 (.network-header-subtitle): 129 (#network-views .network-item-view .tabbed-pane-header): 130 (#network-views.small .network-item-view .tabbed-pane-header): 131 (.network-item-view): 132 (.network-item-view.visible): 133 (.network-item-view .tabbed-pane-header): 134 (.network-item-view .scope-bar li): 135 (.resource-headers-view): 136 (.resource-headers-view.visible): 137 (.resource-headers-view .outline-disclosure .parent): 138 (.resource-headers-view .outline-disclosure .children li): 139 (.resource-headers-view .outline-disclosure li.expanded .header-count): 140 (.resource-headers-view .outline-disclosure .header-name): 141 (.resource-headers-view .outline-disclosure .header-value): 142 (.resource-headers-view .outline-disclosure .raw-form-data): 143 (.resource-cookies-view): 144 (.resource-cookies-view.visible): 145 (.resource-cookies-view .data-grid): 146 (.resource-cookies-view .data-grid .row-group): 147 1 148 2010-11-24 Pavel Feldman <pfeldman@chromium.org> 2 149 -
trunk/WebCore/WebCore.gypi
r72591 r72655 4434 4434 'inspector/front-end/CookieItemsView.js', 4435 4435 'inspector/front-end/CookieParser.js', 4436 'inspector/front-end/CookiesTable.js', 4436 4437 'inspector/front-end/CSSCompletions.js', 4437 4438 'inspector/front-end/CSSStyleModel.js', … … 4468 4469 'inspector/front-end/KeyboardShortcut.js', 4469 4470 'inspector/front-end/MetricsSidebarPane.js', 4471 'inspector/front-end/NetworkItemView.js', 4470 4472 'inspector/front-end/NetworkPanel.js', 4471 4473 'inspector/front-end/Object.js', … … 4483 4485 'inspector/front-end/Resource.js', 4484 4486 'inspector/front-end/ResourceCategory.js', 4487 'inspector/front-end/ResourceCookiesView.js', 4485 4488 'inspector/front-end/ResourceManager.js', 4489 'inspector/front-end/ResourceHeadersView.js', 4486 4490 'inspector/front-end/ResourceView.js', 4487 4491 'inspector/front-end/ResourcesPanel.js', -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r72590 r72655 64751 64751 </File> 64752 64752 <File 64753 RelativePath="..\inspector\front-end\CookiesTable.js" 64754 > 64755 </File> 64756 <File 64753 64757 RelativePath="..\inspector\front-end\CookieParser.js" 64754 64758 > … … 64907 64911 </File> 64908 64912 <File 64913 RelativePath="..\inspector\front-end\NetworkItemView.js" 64914 > 64915 </File> 64916 <File 64909 64917 RelativePath="..\inspector\front-end\NetworkPanel.js" 64910 64918 > … … 64968 64976 <File 64969 64977 RelativePath="..\inspector\front-end\ResourceCategory.js" 64978 > 64979 </File> 64980 <File 64981 RelativePath="..\inspector\front-end\ResourceCookiesView.js" 64982 > 64983 </File> 64984 <File 64985 RelativePath="..\inspector\front-end\ResourceHeadersView.js" 64970 64986 > 64971 64987 </File> -
trunk/WebCore/inspector/front-end/CookieItemsView.js
r70853 r72655 28 28 */ 29 29 30 WebInspector.Cookie sTable = function()30 WebInspector.CookieItemsView = function(treeElement, cookieDomain) 31 31 { 32 32 WebInspector.View.call(this); 33 33 34 this.element.addStyleClass("table");35 }36 37 WebInspector.CookiesTable.prototype = {38 resize: function()39 {40 if (!this._dataGrid)41 return;42 43 if (this._autoSizingDone)44 this._dataGrid.updateWidths();45 else {46 this._autoSizingDone = true;47 this._dataGrid.autoSizeColumns(4, 45, 1);48 }49 },50 51 _createDataGrid: function(expandable)52 {53 var columns = { 0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 7: {} };54 columns[0].title = WebInspector.UIString("Name");55 columns[0].sortable = true;56 columns[0].disclosure = expandable;57 columns[1].title = WebInspector.UIString("Value");58 columns[1].sortable = true;59 columns[2].title = WebInspector.UIString("Domain");60 columns[2].sortable = true;61 columns[3].title = WebInspector.UIString("Path");62 columns[3].sortable = true;63 columns[4].title = WebInspector.UIString("Expires");64 columns[4].sortable = true;65 columns[5].title = WebInspector.UIString("Size");66 columns[5].aligned = "right";67 columns[5].sortable = true;68 columns[6].title = WebInspector.UIString("HTTP");69 columns[6].aligned = "centered";70 columns[6].sortable = true;71 columns[7].title = WebInspector.UIString("Secure");72 columns[7].aligned = "centered";73 columns[7].sortable = true;74 75 var deleteCallback = this._deleteCookieCallback ? this._deleteCookieCallback.bind(this) : null;76 this._dataGrid = new WebInspector.DataGrid(columns, null, deleteCallback);77 this._dataGrid.addEventListener("sorting changed", this._populateDataGrid, this);78 this.element.appendChild(this._dataGrid.element);79 },80 81 _populateCookies: function(parentNode, cookies)82 {83 var selectedCookie = this._dataGrid.selectedNode ? this._dataGrid.selectedNode.cookie : null;84 parentNode.removeChildren();85 if (!cookies)86 return;87 this._sortCookies(cookies);88 var totalSize = 0;89 for (var i = 0; i < cookies.length; ++i) {90 var cookieNode = this._createGridNode(cookies[i]);91 parentNode.appendChild(cookieNode);92 if (selectedCookie === cookies[i])93 cookieNode.selected = true;94 }95 },96 97 _sortCookies: function(cookies)98 {99 var sortDirection = this._dataGrid.sortOrder === "ascending" ? 1 : -1;100 101 function localeCompare(field, cookie1, cookie2)102 {103 return sortDirection * (cookie1[field] + "").localeCompare(cookie2[field] + "")104 }105 106 function numberCompare(field, cookie1, cookie2)107 {108 return sortDirection * (cookie1[field] - cookie2[field]);109 }110 111 function expiresCompare(cookie1, cookie2)112 {113 if (cookie1.session !== cookie2.session)114 return sortDirection * (cookie1.session ? 1 : -1);115 116 if (cookie1.session)117 return 0;118 119 return sortDirection * (cookie1.expires - cookie2.expires);120 }121 122 var comparator;123 switch (parseInt(this._dataGrid.sortColumnIdentifier)) {124 case 0: comparator = localeCompare.bind(this, "name"); break;125 case 1: comparator = localeCompare.bind(this, "value"); break;126 case 2: comparator = localeCompare.bind(this, "domain"); break;127 case 3: comparator = localeCompare.bind(this, "path"); break;128 case 4: comparator = expiresCompare; break;129 case 5: comparator = numberCompare.bind(this, "size"); break;130 case 6: comparator = localeCompare.bind(this, "httpOnly"); break;131 case 7: comparator = localeCompare.bind(this, "secure"); break;132 default: localeCompare.bind(this, "name");133 }134 135 cookies.sort(comparator);136 },137 138 _createGridNode: function(cookie)139 {140 var data = {};141 data[0] = cookie.name;142 data[1] = cookie.value;143 data[2] = cookie.domain || "";144 data[3] = cookie.path || "";145 data[4] = cookie.type === WebInspector.Cookie.Type.Request ? "" :146 (cookie.session ? WebInspector.UIString("Session") : new Date(cookie.expires).toGMTString());147 data[5] = cookie.size;148 data[6] = (cookie.httpOnly ? "\u2713" : ""); // Checkmark149 data[7] = (cookie.secure ? "\u2713" : ""); // Checkmark150 151 var node = new WebInspector.DataGridNode(data);152 node.cookie = cookie;153 node.selectable = true;154 return node;155 }156 };157 158 WebInspector.CookiesTable.prototype.__proto__ = WebInspector.View.prototype;159 160 WebInspector.CookieItemsView = function(treeElement, cookieDomain)161 {162 WebInspector.CookiesTable.call(this);163 164 34 this.element.addStyleClass("storage-view"); 165 35 166 this. deleteButton = new WebInspector.StatusBarButton(WebInspector.UIString("Delete"), "delete-storage-status-bar-item");167 this. deleteButton.visible = false;168 this. deleteButton.addEventListener("click", this._deleteButtonClicked.bind(this), false);169 170 this. refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");171 this. refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false);172 36 this._deleteButton = new WebInspector.StatusBarButton(WebInspector.UIString("Delete"), "delete-storage-status-bar-item"); 37 this._deleteButton.visible = false; 38 this._deleteButton.addEventListener("click", this._deleteButtonClicked.bind(this), false); 39 40 this._refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item"); 41 this._refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false); 42 173 43 this._treeElement = treeElement; 174 44 this._cookieDomain = cookieDomain; … … 183 53 get statusBarItems() 184 54 { 185 return [this. refreshButton.element, this.deleteButton.element];55 return [this._refreshButton.element, this._deleteButton.element]; 186 56 }, 187 57 … … 195 65 { 196 66 WebInspector.View.prototype.hide.call(this); 197 this.deleteButton.visible = false; 67 this._deleteButton.visible = false; 68 }, 69 70 resize: function() 71 { 72 if (this._cookiesTable) 73 this._cookiesTable.updateWidths(); 198 74 }, 199 75 … … 205 81 _updateWithCookies: function(allCookies, isAdvanced) 206 82 { 207 if (isAdvanced) 208 this._filterCookiesForDomain(allCookies); 209 else 210 this._cookies = allCookies; 83 this._cookies = isAdvanced ? this._filterCookiesForDomain(allCookies) : allCookies; 84 211 85 if (!this._cookies.length) { 212 86 // Nothing to show. 213 87 this._emptyMsgElement.removeStyleClass("hidden"); 214 this. deleteButton.visible = false;215 if (this._ dataGrid)216 this._ dataGrid.element.addStyleClass("hidden");88 this._deleteButton.visible = false; 89 if (this._cookiesTable) 90 this._cookiesTable.element.addStyleClass("hidden"); 217 91 return; 218 92 } 219 93 220 if (!this._dataGrid) { 221 if (isAdvanced) { 222 this._createDataGrid(); 223 this._populateDataGrid(); 224 this._dataGrid.autoSizeColumns(6, 33); 225 this._treeElement.subtitle = String.sprintf(WebInspector.UIString("%d cookies (%s)"), this._cookies.length, 226 Number.bytesToString(this._totalSize, WebInspector.UIString)); 227 } else { 228 this._createSimpleDataGrid(); 229 this._populateSimpleDataGrid(); 230 this._dataGrid.autoSizeColumns(20, 80); 231 } 232 } else { 233 if (isAdvanced) 234 this._populateDataGrid(); 235 else 236 this._populateSimpleDataGrid(); 237 } 238 239 this._dataGrid.element.removeStyleClass("hidden"); 94 if (!this._cookiesTable) { 95 this._cookiesTable = isAdvanced ? new WebInspector.CookiesTable(this._cookieDomain, false, this._deleteCookie.bind(this)) : new WebInspector.SimpleCookiesTable(); 96 this.element.appendChild(this._cookiesTable.element); 97 } 98 99 this._cookiesTable.setCookies(this._cookies); 100 this._cookiesTable.element.removeStyleClass("hidden"); 240 101 this._emptyMsgElement.addStyleClass("hidden"); 241 if (isAdvanced) 242 this.deleteButton.visible = true; 102 if (isAdvanced) { 103 this._treeElement.subtitle = String.sprintf(WebInspector.UIString("%d cookies (%s)"), this._cookies.length, 104 Number.bytesToString(this._totalSize, WebInspector.UIString)); 105 this._deleteButton.visible = true; 106 } 243 107 }, 244 108 245 109 _filterCookiesForDomain: function(allCookies) 246 110 { 247 this._cookies = [];111 var cookies = []; 248 112 var resourceURLsForDocumentURL = []; 249 113 this._totalSize = 0; … … 266 130 if (!pushed) { 267 131 pushed = true; 268 this._cookies.push(allCookies[i]);132 cookies.push(allCookies[i]); 269 133 } 270 134 } 271 135 } 272 136 } 273 }, 274 275 _populateDataGrid: function() 276 { 277 this._populateCookies(this._dataGrid, this._cookies); 278 }, 279 280 _createSimpleDataGrid: function() 281 { 282 var columns = {}; 283 columns[0] = {}; 284 columns[1] = {}; 285 columns[0].title = WebInspector.UIString("Name"); 286 columns[1].title = WebInspector.UIString("Value"); 287 288 this._dataGrid = new WebInspector.DataGrid(columns); 289 this.element.appendChild(this._dataGrid.element); 290 this._dataGrid.updateWidths(); 291 }, 292 293 _populateSimpleDataGrid: function() 294 { 295 var cookies = this._cookies; 137 return cookies; 138 }, 139 140 _deleteCookie: function(cookie) 141 { 142 InspectorBackend.deleteCookie(cookie.name, this._cookieDomain); 143 this._update(); 144 }, 145 146 _deleteButtonClicked: function() 147 { 148 if (this._cookiesTable.selectedCookie) 149 this._deleteCookie(this._cookiesTable.selectedCookie); 150 }, 151 152 _refreshButtonClicked: function(event) 153 { 154 this._update(); 155 } 156 } 157 158 WebInspector.CookieItemsView.prototype.__proto__ = WebInspector.View.prototype; 159 160 WebInspector.SimpleCookiesTable = function() 161 { 162 this.element = document.createElement("div"); 163 var columns = {}; 164 columns[0] = {}; 165 columns[1] = {}; 166 columns[0].title = WebInspector.UIString("Name"); 167 columns[1].title = WebInspector.UIString("Value"); 168 169 this._dataGrid = new WebInspector.DataGrid(columns); 170 this._dataGrid.autoSizeColumns(20, 80); 171 this.element.appendChild(this._dataGrid.element); 172 this._dataGrid.updateWidths(); 173 } 174 175 WebInspector.SimpleCookiesTable.prototype = { 176 setCookies: function(cookies) 177 { 296 178 this._dataGrid.removeChildren(); 297 179 var addedCookies = {}; … … 311 193 }, 312 194 313 _deleteButtonClicked: function(event) 314 { 315 if (!this._dataGrid || !this._dataGrid.selectedNode) 316 return; 317 318 this._deleteCookieCallback(this._dataGrid.selectedNode); 319 }, 320 321 _deleteCookieCallback: function(node) 322 { 323 var cookie = node.cookie; 324 InspectorBackend.deleteCookie(cookie.name, this._cookieDomain); 325 this._update(); 326 }, 327 328 _refreshButtonClicked: function(event) 329 { 330 this._update(); 195 resize: function() 196 { 197 if (this._dataGrid) 198 this._dataGrid.updateWidths(); 331 199 } 332 200 } 333 334 WebInspector.CookieItemsView.prototype.__proto__ = WebInspector.CookiesTable.prototype;335 -
trunk/WebCore/inspector/front-end/FileSystemView.js
r71366 r72655 126 126 _selectFileSystemTab: function() 127 127 { 128 this._tabbedPane.selectTab ById("persistent");128 this._tabbedPane.selectTab("persistent"); 129 129 }, 130 130 131 131 selectTemporaryFileSystemTab: function() 132 132 { 133 this._tabbedPane.selectTab ById("temp");133 this._tabbedPane.selectTab("temp"); 134 134 }, 135 135 -
trunk/WebCore/inspector/front-end/FontView.js
r70529 r72655 35 35 36 36 WebInspector.FontView.prototype = { 37 hasContent Tab: function()37 hasContent: function() 38 38 { 39 39 return true; 40 40 }, 41 41 42 contentTabSelected: function()42 _createContentIfNeeded: function() 43 43 { 44 44 if (this.fontPreviewElement) … … 52 52 53 53 this.fontPreviewElement = document.createElement("div"); 54 this. contentElement.appendChild(this.fontPreviewElement);54 this.element.appendChild(this.fontPreviewElement); 55 55 56 56 this.fontPreviewElement.style.setProperty("font-family", uniqueFontName, null); … … 64 64 { 65 65 WebInspector.ResourceView.prototype.show.call(this, parentElement); 66 this._createContentIfNeeded(); 66 67 this.updateFontPreviewSize(); 67 68 }, … … 87 88 88 89 // Subtract some padding. This should match the padding in the CSS plus room for the scrollbar. 89 const containerWidth = this. contentElement.offsetWidth - 50;90 const containerWidth = this.element.offsetWidth - 50; 90 91 91 92 if (!height || !width || !containerWidth) { -
trunk/WebCore/inspector/front-end/ImageView.js
r71254 r72655 35 35 36 36 WebInspector.ImageView.prototype = { 37 hasContent Tab: function()37 hasContent: function() 38 38 { 39 39 return true; 40 40 }, 41 41 42 contentTabSelected: function() 42 show: function(parentElement) 43 { 44 WebInspector.ResourceView.prototype.show.call(this, parentElement); 45 this._createContentIfNeeded(); 46 }, 47 48 _createContentIfNeeded: function() 43 49 { 44 50 if (this._container) 45 51 return; 46 this._container = document.createElement("div"); 47 this._container.className = "image"; 48 this.contentElement.appendChild(this._container); 52 53 var imageContainer = document.createElement("div"); 54 imageContainer.className = "image"; 55 this.element.appendChild(imageContainer); 49 56 50 57 var imagePreviewElement = document.createElement("img"); 51 58 imagePreviewElement.addStyleClass("resource-image-view"); 52 this._container.appendChild(imagePreviewElement);59 imageContainer.appendChild(imagePreviewElement); 53 60 54 61 this._container = document.createElement("div"); 55 62 this._container.className = "info"; 56 this. contentElement.appendChild(this._container);63 this.element.appendChild(this._container); 57 64 58 65 var imageNameElement = document.createElement("h1"); -
trunk/WebCore/inspector/front-end/NetworkPanel.js
r72375 r72655 2 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> 4 * Copyright (C) 20 09, 2010 Google Inc. All rights reserved.4 * Copyright (C) 2010 Google Inc. All rights reserved. 5 5 * 6 6 * Redistribution and use in source and binary forms, with or without … … 642 642 { 643 643 WebInspector.Panel.prototype.show.call(this); 644 645 644 this._refreshIfNeeded(); 646 645 647 var visibleView = this.visibleView; 648 if (this.visibleResource) { 649 this.visibleView.headersVisible = true; 646 if (this.visibleView) 650 647 this.visibleView.show(this._viewsContainerElement); 651 } else if (visibleView) 652 visibleView.show(); 653 654 // Hide any views that are visible that are not this panel's current visible view. 655 // This can happen when a ResourceView is visible in the Scripts panel then switched 656 // to the this panel. 657 var resourcesLength = this._resources.length; 658 for (var i = 0; i < resourcesLength; ++i) { 659 var resource = this._resources[i]; 660 var view = resource._resourcesView; 661 if (!view || view === visibleView) 662 continue; 663 view.visible = false; 664 } 648 665 649 this._dataGrid.updateWidths(); 666 650 this._positionSummaryBar(); … … 695 679 { 696 680 WebInspector.Panel.prototype.performSearch.call(this, query); 697 },698 699 get visibleView()700 {701 if (this.visibleResource)702 return this.visibleResource._resourcesView;703 return null;704 681 }, 705 682 … … 830 807 resource._resourcesView = newView; 831 808 832 newView.headersVisible = oldView.headersVisible;833 834 809 if (oldViewParentNode) 835 810 newView.show(oldViewParentNode); … … 857 832 this._toggleViewingResourceMode(); 858 833 859 if (this.visibleResource && this.visibleResource._resourcesView) 860 this.visibleResource._resourcesView.hide(); 861 862 var view = WebInspector.ResourceManager.resourceViewForResource(resource); 863 view.headersVisible = true; 834 if (this.visibleView) { 835 this.visibleView.detach(); 836 delete this.visibleView; 837 } 838 839 var view = new WebInspector.NetworkItemView(resource); 864 840 view.show(this._viewsContainerElement); 865 866 if (line) { 867 view.selectContentTab(); 868 if (view.revealLine) 869 view.revealLine(line); 870 if (view.highlightLine) 871 view.highlightLine(line); 872 } 873 874 this.visibleResource = resource; 841 this.visibleView = view; 842 875 843 this.updateSidebarWidth(); 876 844 }, … … 880 848 this.element.removeStyleClass("viewing-resource"); 881 849 882 if (this.visibleResource && this.visibleResource._resourcesView) 883 this.visibleResource._resourcesView.hide(); 884 delete this.visibleResource; 850 if (this.visibleView) { 851 this.visibleView.detach(); 852 delete this.visibleView; 853 } 885 854 886 855 if (this._lastSelectedGraphTreeElement) -
trunk/WebCore/inspector/front-end/ResourceView.js
r72072 r72655 8 8 * 9 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer. 11 11 * 2. Redistributions in binary form must reproduce the above copyright 12 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution. 14 14 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of 15 15 * its contributors may be used to endorse or promote products derived 16 * from this software without specific prior written permission. 16 * from this software without specific prior written permission. 17 17 * 18 18 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY … … 31 31 { 32 32 WebInspector.View.call(this); 33 34 33 this.element.addStyleClass("resource-view"); 35 36 34 this.resource = resource; 37 38 this.tabbedPane = new WebInspector.TabbedPane(this.element);39 40 this.headersElement = document.createElement("div");41 this.headersElement.className = "resource-view-headers";42 this.tabbedPane.appendTab("headers", WebInspector.UIString("Headers"), this.headersElement, this._selectTab.bind(this, "headers"));43 44 if (this.hasContentTab()) {45 this.contentElement = document.createElement("div");46 this.contentElement.className = "resource-view-content";47 this.tabbedPane.appendTab("content", WebInspector.UIString("Content"), this.contentElement, this._selectTab.bind(this, "content"));48 }49 50 this.headersListElement = document.createElement("ol");51 this.headersListElement.className = "outline-disclosure";52 this.headersElement.appendChild(this.headersListElement);53 54 this.headersTreeOutline = new TreeOutline(this.headersListElement);55 this.headersTreeOutline.expandTreeElementsWhenArrowing = true;56 57 this.urlTreeElement = new TreeElement("", null, false);58 this.urlTreeElement.selectable = false;59 this.headersTreeOutline.appendChild(this.urlTreeElement);60 61 this.requestMethodTreeElement = new TreeElement("", null, false);62 this.requestMethodTreeElement.selectable = false;63 this.headersTreeOutline.appendChild(this.requestMethodTreeElement);64 65 this.statusCodeTreeElement = new TreeElement("", null, false);66 this.statusCodeTreeElement.selectable = false;67 this.headersTreeOutline.appendChild(this.statusCodeTreeElement);68 69 this.requestHeadersTreeElement = new TreeElement("", null, true);70 this.requestHeadersTreeElement.expanded = true;71 this.requestHeadersTreeElement.selectable = false;72 this.headersTreeOutline.appendChild(this.requestHeadersTreeElement);73 74 this._decodeHover = WebInspector.UIString("Double-Click to toggle between URL encoded and decoded formats");75 this._decodeRequestParameters = true;76 77 this.queryStringTreeElement = new TreeElement("", null, true);78 this.queryStringTreeElement.expanded = true;79 this.queryStringTreeElement.selectable = false;80 this.queryStringTreeElement.hidden = true;81 this.headersTreeOutline.appendChild(this.queryStringTreeElement);82 83 this.formDataTreeElement = new TreeElement("", null, true);84 this.formDataTreeElement.expanded = true;85 this.formDataTreeElement.selectable = false;86 this.formDataTreeElement.hidden = true;87 this.headersTreeOutline.appendChild(this.formDataTreeElement);88 89 this.requestPayloadTreeElement = new TreeElement(WebInspector.UIString("Request Payload"), null, true);90 this.requestPayloadTreeElement.expanded = true;91 this.requestPayloadTreeElement.selectable = false;92 this.requestPayloadTreeElement.hidden = true;93 this.headersTreeOutline.appendChild(this.requestPayloadTreeElement);94 95 this.responseHeadersTreeElement = new TreeElement("", null, true);96 this.responseHeadersTreeElement.expanded = true;97 this.responseHeadersTreeElement.selectable = false;98 this.headersTreeOutline.appendChild(this.responseHeadersTreeElement);99 100 this.headersVisible = true;101 102 resource.addEventListener("requestHeaders changed", this._refreshRequestHeaders, this);103 resource.addEventListener("responseHeaders changed", this._refreshResponseHeaders, this);104 resource.addEventListener("finished", this._refreshHTTPInformation, this);105 106 this._refreshURL();107 this._refreshQueryString();108 this._refreshRequestHeaders();109 this._refreshResponseHeaders();110 this._refreshHTTPInformation();111 this._selectTab();112 35 } 113 36 114 37 WebInspector.ResourceView.prototype = { 115 attach: function()38 hasContent: function() 116 39 { 117 if (!this.element.parentNode) {118 var parentElement = (document.getElementById("resource-views") || document.getElementById("script-resource-views"));119 if (parentElement)120 parentElement.appendChild(this.element);121 }122 },123 124 show: function(parentElement)125 {126 WebInspector.View.prototype.show.call(this, parentElement);127 this._selectTab();128 },129 130 set headersVisible(x)131 {132 if (x === this._headersVisible)133 return;134 this._headersVisible = x;135 if (x)136 this.element.addStyleClass("headers-visible");137 else138 this.element.removeStyleClass("headers-visible");139 this._selectTab();140 },141 142 resize: function()143 {144 if (this._cookiesView && !this._cookiesView.element.hasStyleClass("hidden"))145 this._cookiesView.resize();146 },147 148 selectContentTab: function()149 {150 this._selectTab("content");151 },152 153 _selectTab: function(tab)154 {155 if (tab)156 WebInspector.settings.resourceViewTab = tab;157 else {158 var preferredTab = WebInspector.settings.resourceViewTab;159 tab = "content";160 161 // Honor user tab preference (if we can). Fallback to content if headers not visible, headers otherwise.162 if (this._headersVisible)163 tab = this.tabbedPane.hasTab(preferredTab) ? preferredTab : "headers";164 }165 this.tabbedPane.selectTabById(tab);166 if (tab === "content" && this.hasContentTab())167 this.contentTabSelected();168 },169 170 hasContentTab: function()171 {172 // Derived classes should override this method and define this.contentTabSelected for content rendering.173 40 return false; 174 },175 176 _refreshURL: function()177 {178 this.urlTreeElement.titleHTML = "<div class=\"header-name\">" + WebInspector.UIString("Request URL") + ":</div>" +179 "<div class=\"header-value source-code\">" + this.resource.url.escapeHTML() + "</div>";180 },181 182 _refreshQueryString: function()183 {184 var queryParameters = this.resource.queryParameters;185 this.queryStringTreeElement.hidden = !queryParameters;186 if (queryParameters)187 this._refreshParms(WebInspector.UIString("Query String Parameters"), queryParameters, this.queryStringTreeElement);188 },189 190 _refreshFormData: function()191 {192 this.formDataTreeElement.hidden = true;193 this.requestPayloadTreeElement.hidden = true;194 195 var formData = this.resource.requestFormData;196 if (!formData)197 return;198 199 var formParameters = this.resource.formParameters;200 if (formParameters) {201 this.formDataTreeElement.hidden = false;202 this._refreshParms(WebInspector.UIString("Form Data"), formParameters, this.formDataTreeElement);203 } else {204 this.requestPayloadTreeElement.hidden = false;205 this._refreshRequestPayload(formData);206 }207 },208 209 _refreshRequestPayload: function(formData)210 {211 this.requestPayloadTreeElement.removeChildren();212 213 var title = "<div class=\"raw-form-data header-value source-code\">" + formData.escapeHTML() + "</div>";214 var parmTreeElement = new TreeElement(null, null, false);215 parmTreeElement.titleHTML = title;216 parmTreeElement.selectable = false;217 this.requestPayloadTreeElement.appendChild(parmTreeElement);218 },219 220 _refreshParms: function(title, parms, parmsTreeElement)221 {222 parmsTreeElement.removeChildren();223 224 parmsTreeElement.titleHTML = title + "<span class=\"header-count\">" + WebInspector.UIString(" (%d)", parms.length) + "</span>";225 226 for (var i = 0; i < parms.length; ++i) {227 var name = parms[i].name;228 var value = parms[i].value;229 230 var errorDecoding = false;231 if (this._decodeRequestParameters) {232 if (value.indexOf("%") >= 0) {233 try {234 value = decodeURIComponent(value);235 } catch(e) {236 errorDecoding = true;237 }238 }239 240 value = value.replace(/\+/g, " ");241 }242 243 valueEscaped = value.escapeHTML();244 if (errorDecoding)245 valueEscaped += " <span class=\"error-message\">" + WebInspector.UIString("(unable to decode value)").escapeHTML() + "</span>";246 247 var title = "<div class=\"header-name\">" + name.escapeHTML() + ":</div>";248 title += "<div class=\"header-value source-code\">" + valueEscaped + "</div>";249 250 var parmTreeElement = new TreeElement(null, null, false);251 parmTreeElement.titleHTML = title;252 parmTreeElement.selectable = false;253 parmTreeElement.tooltip = this._decodeHover;254 parmTreeElement.ondblclick = this._toggleURLdecoding.bind(this);255 parmsTreeElement.appendChild(parmTreeElement);256 }257 },258 259 _toggleURLdecoding: function(event)260 {261 this._decodeRequestParameters = !this._decodeRequestParameters;262 this._refreshQueryString();263 this._refreshFormData();264 },265 266 _getHeaderValue: function(headers, key)267 {268 var lowerKey = key.toLowerCase();269 for (var testKey in headers) {270 if (testKey.toLowerCase() === lowerKey)271 return headers[testKey];272 }273 },274 275 _refreshRequestHeaders: function()276 {277 var additionalRow = null;278 if (typeof this.resource.webSocketRequestKey3 !== "undefined")279 additionalRow = {header: "(Key3)", value: this.resource.webSocketRequestKey3};280 this._refreshHeaders(WebInspector.UIString("Request Headers"), this.resource.sortedRequestHeaders, additionalRow, this.requestHeadersTreeElement);281 this._refreshFormData();282 this._refreshCookies();283 },284 285 _refreshResponseHeaders: function()286 {287 var additionalRow = null;288 if (typeof this.resource.webSocketChallengeResponse !== "undefined")289 additionalRow = {header: "(Challenge Response)", value: this.resource.webSocketChallengeResponse};290 this._refreshHeaders(WebInspector.UIString("Response Headers"), this.resource.sortedResponseHeaders, additionalRow, this.responseHeadersTreeElement);291 this._refreshCookies();292 },293 294 _refreshHTTPInformation: function()295 {296 var requestMethodElement = this.requestMethodTreeElement;297 requestMethodElement.hidden = !this.resource.statusCode;298 var statusCodeElement = this.statusCodeTreeElement;299 statusCodeElement.hidden = !this.resource.statusCode;300 var statusCodeImage = "";301 302 if (this.resource.statusCode) {303 var statusImageSource = "";304 if (this.resource.statusCode < 300)305 statusImageSource = "Images/successGreenDot.png";306 else if (this.resource.statusCode < 400)307 statusImageSource = "Images/warningOrangeDot.png";308 else309 statusImageSource = "Images/errorRedDot.png";310 311 var statusTextEscaped = this.resource.statusCode + " " + this.resource.statusText.escapeHTML();312 statusCodeImage = "<img class=\"resource-status-image\" src=\"" + statusImageSource + "\" title=\"" + statusTextEscaped + "\">";313 314 requestMethodElement.titleHTML = "<div class=\"header-name\">" + WebInspector.UIString("Request Method") + ":</div>" +315 "<div class=\"header-value source-code\">" + this.resource.requestMethod + "</div>";316 317 statusCodeElement.titleHTML = "<div class=\"header-name\">" + WebInspector.UIString("Status Code") + ":</div>" +318 statusCodeImage + "<div class=\"header-value source-code\">" + statusTextEscaped + "</div>";319 }320 },321 322 _refreshHeaders: function(title, headers, additionalRow, headersTreeElement)323 {324 headersTreeElement.removeChildren();325 326 var length = headers.length;327 headersTreeElement.titleHTML = title.escapeHTML() + "<span class=\"header-count\">" + WebInspector.UIString(" (%d)", length) + "</span>";328 headersTreeElement.hidden = !length;329 330 var length = headers.length;331 for (var i = 0; i < length; ++i) {332 var title = "<div class=\"header-name\">" + headers[i].header.escapeHTML() + ":</div>";333 title += "<div class=\"header-value source-code\">" + headers[i].value.escapeHTML() + "</div>"334 335 var headerTreeElement = new TreeElement(null, null, false);336 headerTreeElement.titleHTML = title;337 headerTreeElement.selectable = false;338 headersTreeElement.appendChild(headerTreeElement);339 }340 341 if (additionalRow) {342 var title = "<div class=\"header-name\">" + additionalRow.header.escapeHTML() + ":</div>";343 title += "<div class=\"header-value source-code\">" + additionalRow.value.escapeHTML() + "</div>"344 345 var headerTreeElement = new TreeElement(null, null, false);346 headerTreeElement.titleHTML = title;347 headerTreeElement.selectable = false;348 headersTreeElement.appendChild(headerTreeElement);349 }350 },351 352 _refreshCookies: function()353 {354 if (!this._cookiesView) {355 if (!this.resource.requestCookies && !this.resource.responseCookies)356 return;357 this._cookiesView = new WebInspector.ResourceCookiesTab();358 this.tabbedPane.appendTab("cookies", WebInspector.UIString("Cookies"), this._cookiesView, this._selectTab.bind(this, "cookies"));359 }360 this._cookiesView.requestCookies = this.resource.requestCookies;361 this._cookiesView.responseCookies = this.resource.responseCookies;362 41 } 363 42 } 364 43 365 44 WebInspector.ResourceView.prototype.__proto__ = WebInspector.View.prototype; 366 367 WebInspector.ResourceCookiesTab = function()368 {369 WebInspector.CookiesTable.call(this);370 this.element.addStyleClass("resource-view-cookies");371 this._requestCookies = [];372 this._responseCookies = [];373 this._createDataGrid(true);374 this._requestCookiesNode = this._createFolder(WebInspector.UIString("Request Cookies"));375 this._responseCookiesNode = this._createFolder(WebInspector.UIString("Response Cookies"));376 }377 378 WebInspector.ResourceCookiesTab.prototype = {379 show: function(parentElement)380 {381 WebInspector.CookiesTable.prototype.show.call(this, parentElement);382 this.resize();383 },384 385 set requestCookies(cookies)386 {387 if (this._requestCookies === cookies)388 return;389 this._requestCookies = cookies;390 this._populateCookies(this._requestCookiesNode, this._requestCookies);391 },392 393 set responseCookies(cookies)394 {395 if (this._responseCookies === cookies)396 return;397 this._responseCookies = cookies;398 this._populateCookies(this._responseCookiesNode, this._responseCookies);399 },400 401 _populateDataGrid: function()402 {403 this._populateCookies(this._requestCookiesNode, this._requestCookies);404 this._populateCookies(this._responseCookiesNode, this._responseCookies);405 },406 407 _populateCookies: function(parentNode, cookies)408 {409 WebInspector.CookiesTable.prototype._populateCookies.call(this, parentNode, cookies);410 var totalSize = 0;411 if (cookies) {412 for (var i = 0; i < cookies.length; ++i)413 totalSize += cookies[i].size;414 }415 parentNode.expanded = true;416 parentNode.data[5] = totalSize;417 parentNode.refresh();418 },419 420 _createFolder: function(name)421 {422 var data = [ name, "", "", "", "", 0, "", "" ];423 var node = new WebInspector.DataGridNode(data);424 node.selectable = true;425 node.expanded = true;426 this._dataGrid.appendChild(node);427 node.element.addStyleClass("row-group");428 return node;429 }430 };431 432 WebInspector.ResourceCookiesTab.prototype.__proto__ = WebInspector.CookiesTable.prototype; -
trunk/WebCore/inspector/front-end/ResourcesPanel.js
r72654 r72655 105 105 WebInspector.Panel.prototype.show.call(this); 106 106 107 if (this.visibleView instanceof WebInspector.ResourceView) { 108 // SourceViews are shared between the panels. 109 this.visibleView.headersVisible = false; 107 if (this.visibleView instanceof WebInspector.ResourceView) 110 108 this.visibleView.show(this.storageViews); 111 }112 109 113 110 if (this._initializedDefaultSelection) … … 380 377 if (line) { 381 378 var view = WebInspector.ResourceManager.resourceViewForResource(resource); 382 view.selectContentTab();383 379 if (view.revealLine) 384 380 view.revealLine(line); … … 392 388 { 393 389 var view = WebInspector.ResourceManager.resourceViewForResource(resource); 394 view.headersVisible = false;395 390 this._innerShowView(view); 396 391 }, -
trunk/WebCore/inspector/front-end/ScriptsPanel.js
r72462 r72655 214 214 this.sidebarResizeElement.style.right = (this.sidebarElement.offsetWidth - 3) + "px"; 215 215 216 if (this.visibleView) { 217 if (this.visibleView instanceof WebInspector.ResourceView) 218 this.visibleView.headersVisible = false; 216 if (this.visibleView) 219 217 this.visibleView.show(this.viewsContainerElement); 220 } 218 221 219 if (this._attachDebuggerWhenShown) { 222 220 InspectorBackend.enableDebugger(false); … … 599 597 600 598 var view; 601 if (scriptOrResource instanceof WebInspector.Resource) {599 if (scriptOrResource instanceof WebInspector.Resource) 602 600 view = WebInspector.ResourceManager.resourceViewForResource(scriptOrResource); 603 view.headersVisible = false; 604 } else if (scriptOrResource instanceof WebInspector.Script) 601 else if (scriptOrResource instanceof WebInspector.Script) 605 602 view = this.scriptViewForScript(scriptOrResource); 606 603 -
trunk/WebCore/inspector/front-end/SourceView.js
r71254 r72655 34 34 35 35 var canEditScripts = WebInspector.panels.scripts && WebInspector.panels.scripts.canEditScripts() && resource.type === WebInspector.Resource.Type.Script; 36 this.sourceFrame = new WebInspector.SourceFrame(this. contentElement, this._addBreakpoint.bind(this), canEditScripts ? this._editLine.bind(this) : null, this._continueToLine.bind(this));36 this.sourceFrame = new WebInspector.SourceFrame(this.element, this._addBreakpoint.bind(this), canEditScripts ? this._editLine.bind(this) : null, this._continueToLine.bind(this)); 37 37 resource.addEventListener("finished", this._resourceLoadingFinished, this); 38 38 this._frameNeedsSetup = true; … … 51 51 { 52 52 WebInspector.ResourceView.prototype.show.call(this, parentElement); 53 this.setupSourceFrameIfNeeded(); 53 54 this.sourceFrame.visible = true; 54 if (this.localSourceFrame)55 this.localSourceFrame.visible = true;56 55 this.resize(); 57 56 }, … … 63 62 this.sourceFrame.clearLineHighlight(); 64 63 WebInspector.View.prototype.hide.call(this); 65 if (this.localSourceFrame)66 this.localSourceFrame.visible = false;67 64 this._currentSearchResultIndex = -1; 68 65 }, … … 72 69 if (this.sourceFrame) 73 70 this.sourceFrame.resize(); 74 if (this.localSourceFrame)75 this.localSourceFrame.resize();76 WebInspector.ResourceView.prototype.resize.call(this);77 71 }, 78 72 … … 81 75 if (!this._frameNeedsSetup) 82 76 return; 83 84 this.attach();85 77 86 78 delete this._frameNeedsSetup; … … 88 80 }, 89 81 90 hasContent Tab: function()82 hasContent: function() 91 83 { 92 84 return true; 93 },94 95 contentTabSelected: function()96 {97 this.setupSourceFrameIfNeeded();98 85 }, 99 86 … … 209 196 }, 210 197 211 updateLocalContent: function(content, mimeType)212 {213 if (!this.localContentElement) {214 this.localContentElement = document.createElement("div");215 this.localContentElement.className = "resource-view-content";216 this.tabbedPane.appendTab("local", WebInspector.UIString("Local"), this.localContentElement, this.selectLocalContentTab.bind(this));217 this.localSourceFrame = new WebInspector.SourceFrame(this.localContentElement, this._addBreakpoint.bind(this), null, this._continueToLine.bind(this));218 }219 this.localSourceFrame.setContent(mimeType, content, "");220 },221 222 selectLocalContentTab: function()223 {224 this.tabbedPane.selectTabById("local");225 this.localSourceFrame.visible = true;226 if ("resize" in this)227 this.resize();228 },229 230 198 jumpToFirstSearchResult: function() 231 199 { -
trunk/WebCore/inspector/front-end/TabbedPane.js
r71967 r72655 33 33 this.element = element || document.createElement("div"); 34 34 this.element.addStyleClass("tabbed-pane"); 35 this.tabsElement = this.element.createChild("div", "tabbed-pane-header"); 36 this.contentElement = this.element.createChild("div", "tabbed-pane-content"); 37 38 this._tabObjects = {}; 35 this._tabsElement = this.element.createChild("div", "tabbed-pane-header"); 36 this._contentElement = this.element.createChild("div", "tabbed-pane-content"); 37 this._tabs = {}; 39 38 } 40 39 41 40 WebInspector.TabbedPane.prototype = { 42 appendTab: function(id, tabTitle, content, tabClickListener)41 appendTab: function(id, tabTitle, view) 43 42 { 44 43 var tabElement = document.createElement("li"); 45 44 tabElement.textContent = tabTitle; 46 tabElement.addEventListener("click", tabClickListener, false); 47 this.tabsElement.appendChild(tabElement); 48 var tabObject = { tab: tabElement }; 49 if (content instanceof HTMLElement) { 50 tabObject.element = content; 51 this.contentElement.appendChild(content); 52 } 53 else { 54 this.contentElement.appendChild(content.element); 55 tabObject.view = content; 56 } 57 this._tabObjects[id] = tabObject; 45 tabElement.addEventListener("click", this.selectTab.bind(this, id, true), false); 46 47 this._tabsElement.appendChild(tabElement); 48 this._contentElement.appendChild(view.element); 49 50 this._tabs[id] = { tabElement: tabElement, view: view } 58 51 }, 59 52 60 hasTab: function(tabId)53 selectTab: function(id, userGesture) 61 54 { 62 return tabId in this._tabObjects; 63 }, 64 65 selectTabById: function(tabId) 66 { 67 for (var id in this._tabObjects) { 68 if (id === tabId) 69 this._showTab(this._tabObjects[id]); 70 else 71 this._hideTab(this._tabObjects[id]); 55 if (!(id in this._tabs)) 56 return false; 57 58 if (this._currentTab) { 59 this._hideTab(this._currentTab) 60 delete this._currentTab; 72 61 } 73 return this.hasTab(tabId); 62 63 var tab = this._tabs[id]; 64 this._showTab(tab); 65 this._currentTab = tab; 66 if (userGesture) { 67 var event = {tabId: id}; 68 this.dispatchEventToListeners("tab-selected", event); 69 } 70 return true; 74 71 }, 75 72 76 _showTab: function(tab Object)73 _showTab: function(tab) 77 74 { 78 tabObject.tab.addStyleClass("selected"); 79 if (tabObject.element) 80 tabObject.element.removeStyleClass("hidden"); 81 else 82 tabObject.view.visible = true; 75 tab.tabElement.addStyleClass("selected"); 76 tab.view.show(this._contentElement); 83 77 }, 84 78 85 _hideTab: function(tab Object)79 _hideTab: function(tab) 86 80 { 87 tabObject.tab.removeStyleClass("selected"); 88 if (tabObject.element) 89 tabObject.element.addStyleClass("hidden"); 90 else 91 tabObject.view.visible = false; 81 tab.tabElement.removeStyleClass("selected"); 82 tab.view.visible = false; 92 83 } 93 84 } 85 86 WebInspector.TabbedPane.prototype.__proto__ = WebInspector.Object.prototype; -
trunk/WebCore/inspector/front-end/WebKit.qrc
r72090 r72655 22 22 <file>CookieItemsView.js</file> 23 23 <file>CookieParser.js</file> 24 <file>CookiesTable.js</file> 24 25 <file>CSSCompletions.js</file> 25 26 <file>CSSStyleModel.js</file> … … 56 57 <file>KeyboardShortcut.js</file> 57 58 <file>MetricsSidebarPane.js</file> 59 <file>NetworkItemView.js</file> 58 60 <file>NetworkPanel.js</file> 59 61 <file>Object.js</file> … … 71 73 <file>Resource.js</file> 72 74 <file>ResourceCategory.js</file> 75 <file>ResourceCookiesView.js</file> 76 <file>ResourceHeadersView.js</file> 73 77 <file>ResourceManager.js</file> 74 78 <file>ResourceView.js</file> -
trunk/WebCore/inspector/front-end/inspector.css
r72598 r72655 799 799 } 800 800 801 .resource-view {802 display: none;803 position: absolute;804 background: white;805 top: 0;806 left: 0;807 right: 0;808 bottom: 0;809 }810 811 .resource-view.visible {812 display: -webkit-box;813 }814 815 .resource-view .tabbed-pane-header {816 display: none;817 height: 20px;818 background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(236, 236, 236)), to(rgb(217, 217, 217)));819 border-bottom: 1px solid rgb(163, 163, 163);820 }821 822 .resource-view.headers-visible .tabbed-pane-header {823 display: block;824 }825 826 .resource-view .scope-bar li {827 border-bottom-left-radius: 0;828 border-bottom-right-radius: 0;829 }830 831 .resource-view-headers {832 padding: 6px;833 -webkit-user-select: text;834 position: absolute;835 top: 0;836 left: 0;837 right: 0;838 bottom: 0;839 overflow: auto;840 }841 842 .resource-view-headers .outline-disclosure .parent {843 -webkit-user-select: none;844 font-weight: bold;845 }846 847 .resource-view-headers .outline-disclosure .children li {848 white-space: nowrap;849 }850 851 .resource-view-headers .outline-disclosure li.expanded .header-count {852 display: none;853 }854 855 .resource-view-headers .outline-disclosure .header-name {856 color: rgb(33%, 33%, 33%);857 display: inline-block;858 margin-right: 0.5em;859 font-weight: bold;860 vertical-align: top;861 white-space: pre-wrap;862 }863 864 .resource-view-headers .outline-disclosure .header-value {865 display: inline;866 margin-right: 100px;867 white-space: pre-wrap;868 word-break: break-all;869 margin-top: 1px;870 }871 872 .resource-view-headers .outline-disclosure .raw-form-data {873 white-space:pre-wrap;874 }875 876 .resource-view .resource-view-content {877 position: absolute;878 top: 0;879 right: 0;880 left: 0;881 bottom: 0;882 overflow: auto;883 }884 885 .resource-view-cookies {886 display: none;887 position: absolute;888 top: 0;889 right: 0;890 left: 0;891 bottom: 0;892 overflow: auto;893 padding: 12px;894 height: 100%;895 }896 897 .resource-view-cookies.visible {898 display: block;899 }900 901 .resource-view-cookies.table .data-grid {902 height: 100%;903 }904 905 .resource-view-cookies .data-grid .row-group {906 font-weight: bold;907 font-size: 11px;908 }909 910 801 .webkit-line-gutter-backdrop { 911 802 /* Keep this in sync with view-source.css (.webkit-line-gutter-backdrop) */ … … 920 811 } 921 812 922 .resource-view.font .resource-view-content { 813 .resource-view { 814 display: none; 815 position: absolute; 816 top: 0; 817 right: 0; 818 left: 0; 819 bottom: 0; 820 overflow: auto; 821 } 822 823 .resource-view.visible { 824 display: block; 825 } 826 827 .resource-view.font { 923 828 font-size: 60px; 924 829 white-space: pre-wrap; … … 928 833 } 929 834 930 .resource-view.image .resource-view-content> .image {835 .resource-view.image > .image { 931 836 padding: 20px 20px 10px 20px; 932 837 text-align: center; 933 838 } 934 839 935 .resource-view.image .resource-view-content> .info {840 .resource-view.image > .info { 936 841 padding-bottom: 10px; 937 842 font-size: 11px; … … 2003 1908 } 2004 1909 2005 .storage-view .table{1910 .storage-view { 2006 1911 overflow: hidden; 2007 1912 } 2008 1913 2009 .storage-view .table.data-grid {1914 .storage-view .data-grid { 2010 1915 border: none; 2011 1916 height: 100%; 2012 1917 } 2013 1918 2014 .storage-empty-view, .storage-view .table.storage-table-error {1919 .storage-empty-view, .storage-view .storage-table-error { 2015 1920 position: absolute; 2016 1921 top: 0; … … 2030 1935 } 2031 1936 2032 .storage-view .table.storage-table-error {1937 .storage-view .storage-table-error { 2033 1938 color: rgb(66%, 33%, 33%); 2034 1939 } -
trunk/WebCore/inspector/front-end/inspector.html
r72090 r72655 68 68 <script type="text/javascript" src="DOMStorageItemsView.js"></script> 69 69 <script type="text/javascript" src="DataGrid.js"></script> 70 <script type="text/javascript" src="CookiesTable.js"></script> 70 71 <script type="text/javascript" src="CookieItemsView.js"></script> 71 72 <script type="text/javascript" src="ApplicationCacheItemsView.js"></script> … … 113 114 <script type="text/javascript" src="AuditCategories.js"></script> 114 115 <script type="text/javascript" src="AuditFormatters.js"></script> 116 <script type="text/javascript" src="ResourceHeadersView.js"></script> 117 <script type="text/javascript" src="ResourceCookiesView.js"></script> 118 <script type="text/javascript" src="NetworkItemView.js"></script> 115 119 <script type="text/javascript" src="ResourceView.js"></script> 116 120 <script type="text/javascript" src="SourceFrame.js"></script> -
trunk/WebCore/inspector/front-end/networkPanel.css
r71906 r72655 98 98 .network-cell-subtitle { 99 99 font-weight: normal; 100 color: grey; 100 color: gray; 101 } 102 103 .network-sidebar tr.selected .network-cell-subtitle { 104 color: white; 101 105 } 102 106 103 107 .network-header-subtitle { 104 color: gr ey;108 color: gray; 105 109 } 106 110 … … 630 634 } 631 635 632 #network-views . resource-view .tabbed-pane-header {636 #network-views .network-item-view .tabbed-pane-header { 633 637 height: 31px; 634 638 padding-top: 8px; … … 636 640 } 637 641 638 #network-views.small . resource-view .tabbed-pane-header {642 #network-views.small .network-item-view .tabbed-pane-header { 639 643 height: 23px; 640 644 padding-top: 0; … … 644 648 padding-right: 0; 645 649 } 650 651 .network-item-view { 652 display: none; 653 position: absolute; 654 background: white; 655 top: 0; 656 left: 0; 657 right: 0; 658 bottom: 0; 659 } 660 661 .network-item-view.visible { 662 display: -webkit-box; 663 } 664 665 .network-item-view .tabbed-pane-header { 666 height: 20px; 667 background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(236, 236, 236)), to(rgb(217, 217, 217))); 668 border-bottom: 1px solid rgb(163, 163, 163); 669 } 670 671 .network-item-view .scope-bar li { 672 border-bottom-left-radius: 0; 673 border-bottom-right-radius: 0; 674 } 675 676 .resource-headers-view { 677 display: none; 678 padding: 6px; 679 -webkit-user-select: text; 680 position: absolute; 681 top: 0; 682 left: 0; 683 right: 0; 684 bottom: 0; 685 overflow: auto; 686 } 687 688 .resource-headers-view.visible { 689 display: block; 690 } 691 692 .resource-headers-view .outline-disclosure .parent { 693 -webkit-user-select: none; 694 font-weight: bold; 695 } 696 697 .resource-headers-view .outline-disclosure .children li { 698 white-space: nowrap; 699 } 700 701 .resource-headers-view .outline-disclosure li.expanded .header-count { 702 display: none; 703 } 704 705 .resource-headers-view .outline-disclosure .header-name { 706 color: rgb(33%, 33%, 33%); 707 display: inline-block; 708 margin-right: 0.5em; 709 font-weight: bold; 710 vertical-align: top; 711 white-space: pre-wrap; 712 } 713 714 .resource-headers-view .outline-disclosure .header-value { 715 display: inline; 716 margin-right: 100px; 717 white-space: pre-wrap; 718 word-break: break-all; 719 margin-top: 1px; 720 } 721 722 .resource-headers-view .outline-disclosure .raw-form-data { 723 white-space: pre-wrap; 724 } 725 726 .resource-cookies-view { 727 display: none; 728 position: absolute; 729 top: 0; 730 right: 0; 731 left: 0; 732 bottom: 0; 733 overflow: auto; 734 padding: 12px; 735 height: 100%; 736 } 737 738 .resource-cookies-view.visible { 739 display: block; 740 } 741 742 .resource-cookies-view .data-grid { 743 height: 100%; 744 } 745 746 .resource-cookies-view .data-grid .row-group { 747 font-weight: bold; 748 font-size: 11px; 749 }
Note: See TracChangeset
for help on using the changeset viewer.