Changeset 60414 in webkit
- Timestamp:
- May 30, 2010 6:16:21 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r60413 r60414 1 2010-05-30 Jessie Berlin <jberlin@webkit.org> 2 3 Reviewed by Pavel Feldman. 4 5 https://bugs.webkit.org/show_bug.cgi?id=39224 6 Bug 39224 - Web Inspector: There should be a way to clean up profiles 7 8 Adds a button to clear the profiles from the profiles panel like that 9 used for the console, the audits panel, and the timeline panel. 10 Consolidates the css rules, since they all use the same image. 11 Also allows for individual profiles to be deleted via the keyboard 12 (U+0008 or U+007F) and uses this new schema for the Elements Tree. 13 14 * English.lproj/localizedStrings.js: 15 Add tooltip text for the button to clear the profiles pane. 16 17 * inspector/InspectorBackend.idl: 18 Add ability to remove the profiles from the backend when they are 19 deleted or cleared in the frontend. 20 * inspector/InspectorBackend.cpp: 21 (WebCore::InspectorBackend::removeProfile): 22 (WebCore::InspectorBackend::clearProfiles): 23 * inspector/InspectorBackend.h: 24 * inspector/InspectorController.cpp: 25 (WebCore::InspectorController::removeProfile): 26 (WebCore::InspectorController::clearProfiles): 27 * inspector/InspectorController.h: 28 29 * inspector/front-end/AuditsPanel.js: 30 (WebInspector.AuditsPanel): 31 Use the 'clear-status-bar-item' class. 32 * inspector/front-end/ChangesView.js: 33 (WebInspector.ChangesView): 34 * inspector/front-end/TimelinePanel.js: 35 (WebInspector.TimelinePanel.prototype._createStatusbarButtons): 36 * inspector/front-end/audits.css: 37 * inspector/front-end/inspector.css: 38 (.clear-status-bar-item .glyph): 39 * inspector/front-end/inspector.html: 40 41 * inspector/front-end/ElementsTreeOutline.js: 42 Replace the keyDown handler on the Outline with specific methods to 43 handle delete and enter on the TreeElements. 44 (WebInspector.ElementsTreeOutline): 45 (WebInspector.ElementsTreeOutline.prototype.get editing): 46 Return whether or not an element in the tree is currently being edited. 47 (WebInspector.ElementsTreeElement.prototype.ondelete): 48 (WebInspector.ElementsTreeElement.prototype.onenter): 49 50 * inspector/front-end/Panel.js: 51 (WebInspector.Panel.prototype.createSidebar): 52 Make the TreeOutline for a Panel's sidebar aware of its enclosing Panel. 53 54 * inspector/front-end/ProfilesPanel.js: 55 (WebInspector.ProfilesPanel): 56 Add the clear button. 57 (WebInspector.ProfilesPanel.prototype.get statusBarItems): 58 (WebInspector.ProfilesPanel.prototype._clearProfiles): 59 Remove the profiles from the backend, the reset the frontend interface. 60 (WebInspector.ProfilesPanel.prototype.removeProfileHeader): 61 Remove the profile from both the frontend and the backend, and clear the 62 view when the last profile is removed. 63 (WebInspector.ProfilesPanel.prototype._updateInterface): 64 Hide the clear button when profiling is disabled. 65 (WebInspector.ProfileSidebarTreeElement.prototype.onselect): 66 Replace access to global variable with reference to the Panel held by the 67 TreeOutline. 68 (WebInspector.ProfileSidebarTreeElement.prototype.ondelete): 69 Remove the profile corresponding the tree element when the user deletes 70 that tree element. 71 72 * inspector/front-end/treeoutline.js: 73 (TreeOutline.prototype._treeKeyDown): 74 Allow the selected tree element to handle the user pressing a delete 75 key or enter key. 76 1 77 2010-05-29 Lucas De Marchi <lucas.demarchi@profusion.mobi> 2 78 -
trunk/WebCore/inspector/InspectorBackend.cpp
r56683 r60414 255 255 m_inspectorController->getProfile(callId, uid); 256 256 } 257 258 void InspectorBackend::removeProfile(unsigned uid) 259 { 260 if (m_inspectorController) 261 m_inspectorController->removeProfile(uid); 262 } 263 264 void InspectorBackend::clearProfiles() 265 { 266 if (m_inspectorController) 267 m_inspectorController->clearProfiles(); 268 } 257 269 #endif 258 270 -
trunk/WebCore/inspector/InspectorBackend.h
r56683 r60414 99 99 void getProfileHeaders(long callId); 100 100 void getProfile(long callId, unsigned uid); 101 102 void removeProfile(unsigned uid); 103 void clearProfiles(); 101 104 #endif 102 105 -
trunk/WebCore/inspector/InspectorBackend.idl
r56683 r60414 74 74 void getProfileHeaders(in long callId); 75 75 void getProfile(in long callId, in unsigned long uid); 76 77 void removeProfile(in unsigned long uid); 78 void clearProfiles(); 76 79 #endif 77 80 void setInjectedScriptSource(in DOMString scriptSource); -
trunk/WebCore/inspector/InspectorController.cpp
r60354 r60414 1389 1389 } 1390 1390 1391 void InspectorController::removeProfile(unsigned uid) 1392 { 1393 if (!enabled()) 1394 return; 1395 1396 if (m_profiles.contains(uid)) 1397 m_profiles.remove(uid); 1398 } 1399 1400 void InspectorController::clearProfiles() 1401 { 1402 if (!enabled()) 1403 return; 1404 1405 m_profiles.clear(); 1406 m_currentUserInitiatedProfileNumber = 1; 1407 m_nextUserInitiatedProfileNumber = 1; 1408 } 1409 1391 1410 void InspectorController::getProfileHeaders(long callId) 1392 1411 { -
trunk/WebCore/inspector/InspectorController.h
r60234 r60414 223 223 void addProfileFinishedMessageToConsole(PassRefPtr<ScriptProfile>, unsigned lineNumber, const String& sourceURL); 224 224 void addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL); 225 void removeProfile(unsigned); 226 void clearProfiles(); 225 227 226 228 bool isRecordingUserInitiatedProfile() const { return m_recordingUserInitiatedProfile; } -
trunk/WebCore/inspector/front-end/AuditsPanel.js
r56732 r60414 50 50 this.element.addStyleClass("audits"); 51 51 52 this.clearResultsButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear audit results."), "clear- audit-results-status-bar-item");52 this.clearResultsButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear audit results."), "clear-status-bar-item"); 53 53 this.clearResultsButton.addEventListener("click", this._clearButtonClicked.bind(this), false); 54 54 -
trunk/WebCore/inspector/front-end/ChangesView.js
r46732 r60414 38 38 this.clearButton.id = "clear-changes-status-bar-item"; 39 39 this.clearButton.title = WebInspector.UIString("Clear changes log."); 40 this.clearButton.className = "status-bar-item ";40 this.clearButton.className = "status-bar-item clear-status-bar-item"; 41 41 this.clearButton.addEventListener("click", this._clearButtonClicked.bind(this), false); 42 42 -
trunk/WebCore/inspector/front-end/ElementsTreeOutline.js
r59468 r60414 44 44 45 45 this.element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true); 46 this.element.addEventListener("keydown", this._keyDown.bind(this), true);47 46 } 48 47 … … 116 115 } 117 116 } 117 }, 118 119 get editing() 120 { 121 return this._editing; 118 122 }, 119 123 … … 225 229 226 230 return element; 227 },228 229 _keyDown: function(event)230 {231 if (event.target !== this.treeOutline.element)232 return;233 234 var selectedElement = this.selectedTreeElement;235 if (!selectedElement)236 return;237 238 if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Backspace.code ||239 event.keyCode === WebInspector.KeyboardShortcut.Keys.Delete.code) {240 var startTagTreeElement = this.findTreeElement(selectedElement.representedObject);241 if (selectedElement !== startTagTreeElement)242 selectedElement = startTagTreeElement;243 selectedElement.remove();244 event.preventDefault();245 event.stopPropagation();246 return;247 }248 249 // On Enter or Return start editing the first attribute250 // or create a new attribute on the selected element.251 if (isEnterKey(event)) {252 if (this._editing)253 return;254 255 selectedElement._startEditing();256 257 // prevent a newline from being immediately inserted258 event.preventDefault();259 event.stopPropagation();260 return;261 }262 231 }, 263 232 … … 685 654 this.updateSelection(); 686 655 this.treeOutline.suppressRevealAndSelect = false; 656 }, 657 658 ondelete: function() 659 { 660 var startTagTreeElement = this.treeOutline.findTreeElement(this.representedObject); 661 startTagTreeElement ? startTagTreeElement.remove() : this.remove(); 662 return true; 663 }, 664 665 onenter: function() 666 { 667 // On Enter or Return start editing the first attribute 668 // or create a new attribute on the selected element. 669 if (this.treeOutline.editing) 670 return false; 671 672 this._startEditing(); 673 674 // prevent a newline from being immediately inserted 675 return true; 687 676 }, 688 677 -
trunk/WebCore/inspector/front-end/Panel.js
r60141 r60414 317 317 318 318 this.sidebarTree = new TreeOutline(this.sidebarTreeElement); 319 this.sidebarTree.panel = this; 319 320 }, 320 321 -
trunk/WebCore/inspector/front-end/ProfilesPanel.js
r58745 r60414 114 114 this.enableToggleButton.addEventListener("click", this._toggleProfiling.bind(this), false); 115 115 116 this.clearResultsButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear CPU profiles."), "clear-status-bar-item"); 117 this.clearResultsButton.addEventListener("click", this._clearProfiles.bind(this), false); 118 116 119 this.profileViewStatusBarItemsContainer = document.createElement("div"); 117 120 this.profileViewStatusBarItemsContainer.id = "profile-view-status-bar-items"; … … 152 155 } 153 156 } 154 items.push(this. profileViewStatusBarItemsContainer);157 items.push(this.clearResultsButton.element, this.profileViewStatusBarItemsContainer); 155 158 return items; 156 159 }, … … 215 218 this._updateInterface(); 216 219 this.welcomeView.show(); 220 }, 221 222 _clearProfiles: function() 223 { 224 InspectorBackend.clearProfiles(); 225 this.reset(); 217 226 }, 218 227 … … 338 347 339 348 sidebarParent.removeChild(profile._profilesTreeElement); 349 350 if (!profile.isTemporary) 351 InspectorBackend.removeProfile(profile.uid); 352 353 // No other item will be selected if there aren't any other profiles, so 354 // make sure that view gets cleared when the last profile is removed. 355 if (!this._profiles.length) 356 this.closeVisibleView(); 340 357 }, 341 358 … … 467 484 this._profileTypeButtonsByIdMap[typeId].removeStyleClass("hidden"); 468 485 this.profileViewStatusBarItemsContainer.removeStyleClass("hidden"); 486 this.clearResultsButton.element.removeStyleClass("hidden"); 469 487 this.panelEnablerView.visible = false; 470 488 } else { … … 474 492 this._profileTypeButtonsByIdMap[typeId].addStyleClass("hidden"); 475 493 this.profileViewStatusBarItemsContainer.addStyleClass("hidden"); 494 this.clearResultsButton.element.addStyleClass("hidden"); 476 495 this.panelEnablerView.visible = true; 477 496 } … … 541 560 onselect: function() 542 561 { 543 WebInspector.panels.profiles.showProfile(this.profile); 562 this.treeOutline.panel.showProfile(this.profile); 563 }, 564 565 ondelete: function() 566 { 567 this.treeOutline.panel.removeProfileHeader(this.profile); 568 return true; 544 569 }, 545 570 -
trunk/WebCore/inspector/front-end/TimelinePanel.js
r60412 r60414 205 205 this.toggleTimelineButton.addEventListener("click", this._toggleTimelineButtonClicked.bind(this), false); 206 206 207 this.clearButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear"), " timeline-clear-status-bar-item");207 this.clearButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear"), "clear-status-bar-item"); 208 208 this.clearButton.addEventListener("click", this._clearPanel.bind(this), false); 209 209 -
trunk/WebCore/inspector/front-end/audits.css
r57127 r60414 47 47 } 48 48 49 button.clear-audit-results-status-bar-item .glyph {50 -webkit-mask-image: url(Images/clearConsoleButtonGlyph.png);51 }52 53 49 .audit-launcher-view { 54 50 z-index: 1000; -
trunk/WebCore/inspector/front-end/inspector.css
r60141 r60414 421 421 } 422 422 423 #clear-console-status-bar-item .glyph {423 .clear-status-bar-item .glyph { 424 424 -webkit-mask-image: url(Images/clearConsoleButtonGlyph.png); 425 425 } … … 427 427 #changes-status-bar-item .glyph { 428 428 -webkit-mask-image: url(Images/consoleButtonGlyph.png); /* TODO: Needs Image for Changes Toggle Button */ 429 }430 431 #clear-changes-status-bar-item .glyph {432 -webkit-mask-image: url(Images/clearConsoleButtonGlyph.png);433 429 } 434 430 … … 3432 3428 } 3433 3429 3434 .timeline-clear-status-bar-item .glyph {3435 -webkit-mask-image: url(Images/clearConsoleButtonGlyph.png);3436 }3437 3438 3430 .timeline-category-statusbar-item { 3439 3431 height: 24px; -
trunk/WebCore/inspector/front-end/inspector.html
r60141 r60414 142 142 <div id="drawer"> 143 143 <div id="console-view"><div id="console-messages" class="monospace"><div id="console-prompt" spellcheck="false"><br></div></div></div> 144 <div id="drawer-status-bar" class="status-bar"><div id="other-drawer-status-bar-items"><button id="clear-console-status-bar-item" class="status-bar-item "><div class="glyph"></div><div class="glyph shadow"></div></button><div id="console-filter" class="scope-bar status-bar-item"></div></div></div>144 <div id="drawer-status-bar" class="status-bar"><div id="other-drawer-status-bar-items"><button id="clear-console-status-bar-item" class="status-bar-item clear-status-bar-item"><div class="glyph"></div><div class="glyph shadow"></div></button><div id="console-filter" class="scope-bar status-bar-item"></div></div></div> 145 145 </div> 146 146 </body> -
trunk/WebCore/inspector/front-end/treeoutline.js
r59150 r60414 390 390 } 391 391 } 392 } else if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Backspace.code || event.keyCode === WebInspector.KeyboardShortcut.Keys.Delete.code) { 393 if (this.selectedTreeElement.ondelete) 394 handled = this.selectedTreeElement.ondelete(); 395 } else if (isEnterKey(event)) { 396 if (this.selectedTreeElement.onenter) 397 handled = this.selectedTreeElement.onenter(); 392 398 } 393 399 -
trunk/WebKit/chromium/ChangeLog
r60411 r60414 1 2010-05-30 Jessie Berlin <jberlin@webkit.org> 2 3 Reviewed by Pavel Feldman. 4 5 https://bugs.webkit.org/show_bug.cgi?id=39224 6 Bug 39224 - Web Inspector: There should be a way to clean up profiles 7 8 * src/js/InspectorControllerImpl.js: 9 (devtools.InspectorBackendImpl): 10 1 11 2010-05-29 Vangelis Kokkevis <vangelis@chromium.org> 2 12 -
trunk/WebKit/chromium/src/js/InspectorControllerImpl.js
r60154 r60414 57 57 this.installInspectorControllerDelegate_("getProfile"); 58 58 this.installInspectorControllerDelegate_("getProfileHeaders"); 59 this.installInspectorControllerDelegate_("removeProfile"); 60 this.installInspectorControllerDelegate_("clearProfiles"); 59 61 this.installInspectorControllerDelegate_("getResourceContent"); 60 62 this.installInspectorControllerDelegate_("highlightDOMNode");
Note: See TracChangeset
for help on using the changeset viewer.