Changeset 72654 in webkit
- Timestamp:
- Nov 24, 2010 2:28:27 AM (13 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r72652 r72654 1 2010-11-24 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: add "Locally modified" group into the resource panel. 6 https://bugs.webkit.org/show_bug.cgi?id=50005 7 8 * English.lproj/localizedStrings.js: 9 * inspector/front-end/ResourcesPanel.js: 10 (WebInspector.ResourcesPanel): 11 (WebInspector.ResourcesPanel.prototype.reset): 12 (WebInspector.ResourcesPanel.prototype.addLocallyModifiedRevision): 13 (WebInspector.ResourcesPanel.prototype._innerShowView): 14 (WebInspector.BaseStorageTreeElement.prototype.set titleText): 15 (WebInspector.LocallyModifiedResourceTreeElement): 16 (WebInspector.LocallyModifiedResourceTreeElement.prototype.onselect): 17 (WebInspector.LocallyModifiedResourceTreeElement.prototype.gcRevisions): 18 (WebInspector.LocallyModifiedRevisionTreeElement): 19 (WebInspector.LocallyModifiedRevisionTreeElement.prototype.onattach): 20 (WebInspector.LocallyModifiedRevisionTreeElement.prototype.onselect): 21 (WebInspector.LocallyModifiedRevisionTreeElement.prototype._ondragstart): 22 1 23 2010-11-24 Pavel Feldman <pfeldman@chromium.org> 2 24 -
trunk/WebCore/inspector/front-end/ResourcesPanel.js
r72090 r72654 57 57 this.sidebarTree.appendChild(this.applicationCacheListTreeElement); 58 58 59 this.locallyModifiedListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Locally Modified"), "LocallyModified", "frame-storage-tree-item"); 60 this.sidebarTree.appendChild(this.locallyModifiedListTreeElement); 61 this.locallyModifiedListTreeElement.hidden = true; 62 59 63 if (Preferences.fileSystemEnabled) { 60 64 this.fileSystemListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("File System"), "FileSystem", "file-system-storage-tree-item"); … … 62 66 this.fileSystemListTreeElement.expand(); 63 67 } 64 68 65 69 this.storageViews = document.createElement("div"); 66 70 this.storageViews.id = "storage-views"; … … 75 79 this._origins = {}; 76 80 this._domains = {}; 81 this._locallyModifiedResources = {}; 77 82 78 83 this.sidebarElement.addEventListener("mousemove", this._onmousemove.bind(this), false); … … 148 153 149 154 this._cookieViews = {}; 150 155 this._locallyModifiedResources = {}; 151 156 this._fileSystemView = null; 152 157 … … 159 164 this.cookieListTreeElement.removeChildren(); 160 165 this.applicationCacheListTreeElement.removeChildren(); 166 this.locallyModifiedListTreeElement.removeChildren(); 161 167 if (Preferences.fileSystemEnabled) 162 168 this.fileSystemListTreeElement.removeChildren(); … … 307 313 else 308 314 this.sessionStorageListTreeElement.appendChild(domStorageTreeElement); 315 }, 316 317 addLocallyModifiedRevision: function(url, resourceType, content) 318 { 319 this.locallyModifiedListTreeElement.hidden = false; 320 321 var newRevision = new WebInspector.LocallyModifiedRevisionTreeElement(this, url, resourceType, content); 322 var lastRevision = this._locallyModifiedResources[url]; 323 this._locallyModifiedResources[url] = newRevision; 324 325 if (lastRevision) 326 lastRevision.becomeLogEntry(newRevision); 327 else 328 this.locallyModifiedListTreeElement.appendChild(newRevision); 309 329 }, 310 330 … … 458 478 { 459 479 if (this.visibleView) 460 this.visibleView. hide();480 this.visibleView.detach(); 461 481 462 482 view.show(this.storageViews); … … 814 834 { 815 835 this._titleText = titleText; 816 this.titleElement.textContent = this._titleText; 836 if (this.titleElement) 837 this.titleElement.textContent = this._titleText; 817 838 }, 818 839 … … 1182 1203 WebInspector.ApplicationCacheTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype; 1183 1204 1205 WebInspector.LocallyModifiedRevisionTreeElement = function(storagePanel, url, resourceType, content) 1206 { 1207 var resource = new WebInspector.Resource(null, url); 1208 resource.type = resourceType; 1209 resource.content = content; 1210 1211 var timestamp = new Date(); 1212 WebInspector.BaseStorageTreeElement.call(this, storagePanel, null, resource.displayName, "resource-sidebar-tree-item resources-category-" + resource.category.name); 1213 this.tooltip = resource.url; 1214 this.timestamp = timestamp; 1215 this._resource = resource; 1216 } 1217 1218 WebInspector.LocallyModifiedRevisionTreeElement.prototype = { 1219 becomeLogEntry: function(newRevision) 1220 { 1221 var oldChildren = this.children.slice(); 1222 var oldExpanded = this.expanded; 1223 var oldIndex = this.parent.children.indexOf(this); 1224 1225 this.removeChildren(); 1226 this.titleText = this.timestamp.toLocaleTimeString(); 1227 this.toLocaleString(); 1228 this.hasChildren = false; 1229 1230 this.parent.insertChild(newRevision, oldIndex); 1231 this.parent.removeChild(this); 1232 1233 const oneMinute = 1000 * 60; 1234 if (newRevision.timestamp - this.timestamp > oneMinute) 1235 newRevision.appendChild(this); 1236 1237 for (var i = 0; i < oldChildren.length; ++i) 1238 newRevision.appendChild(oldChildren[i]); 1239 if (oldExpanded) 1240 newRevision.expand(); 1241 }, 1242 1243 onattach: function() 1244 { 1245 WebInspector.BaseStorageTreeElement.prototype.onattach.call(this); 1246 this.listItemElement.draggable = true; 1247 this.listItemElement.addEventListener("dragstart", this._ondragstart.bind(this), false); 1248 }, 1249 1250 onselect: function() 1251 { 1252 WebInspector.BaseStorageTreeElement.prototype.onselect.call(this); 1253 this._storagePanel._showResourceView(this._resource); 1254 }, 1255 1256 _ondragstart: function(event) 1257 { 1258 event.dataTransfer.setData("text/plain", this._resource.content); 1259 event.dataTransfer.effectAllowed = "copy"; 1260 return true; 1261 } 1262 } 1263 WebInspector.LocallyModifiedRevisionTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype; 1264 1184 1265 WebInspector.FileSystemTreeElement = function(storagePanel, origin) 1185 1266 {
Note: See TracChangeset
for help on using the changeset viewer.