Changeset 130288 in webkit
- Timestamp:
- Oct 3, 2012, 7:46:59 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r130287 r130288 1 2012-10-03 Pavel Feldman <pfeldman@chromium.org> 2 3 Web Inspector: remember the last dock option so that user could toggle between dock to bottom and right 4 https://bugs.webkit.org/show_bug.cgi?id=98255 5 6 Reviewed by Vsevolod Vlasov. 7 8 - Introduced DockController.js that covers the dock mechanics 9 - Removed dock orientation from the settings 10 - Storing the last dock option to present it as default 11 - Simplified the multi-option status bar button 12 13 * WebCore.gypi: 14 * WebCore.vcproj/WebCore.vcproj: 15 * inspector/compile-front-end.py: 16 * inspector/front-end/DockController.js: Added. 17 (WebInspector.DockController): 18 (WebInspector.DockController.prototype.get element): 19 (WebInspector.DockController.prototype.setDocked.set if): 20 (WebInspector.DockController.prototype.setDocked): 21 (WebInspector.DockController.prototype.setDockingUnavailable): 22 (WebInspector.DockController.prototype._updateUI.get states): 23 (WebInspector.DockController.prototype._updateUI): 24 (WebInspector.DockController.prototype._decorateButtonForTargetState): 25 (WebInspector.DockController.prototype._createDockOptions): 26 (WebInspector.DockController.prototype._toggleDockState): 27 (WebInspector.DockController.prototype.isCompactMode): 28 (WebInspector.DockController.prototype.setCompactMode): 29 * inspector/front-end/InspectorFrontendAPI.js: 30 (InspectorFrontendAPI.setAttachedWindow): 31 * inspector/front-end/InspectorFrontendHostStub.js: 32 (.WebInspector.InspectorFrontendHostStub.prototype.requestAttachWindow): 33 (.WebInspector.InspectorFrontendHostStub.prototype.requestDetachWindow): 34 * inspector/front-end/Settings.js: 35 * inspector/front-end/SettingsScreen.js: 36 (WebInspector.GenericSettingsTab): 37 * inspector/front-end/StatusBarButton.js: 38 (WebInspector.StatusBarButton): 39 * inspector/front-end/Toolbar.js: 40 (WebInspector.Toolbar): 41 (WebInspector.Toolbar.prototype.setCompactMode): 42 (WebInspector.Toolbar.prototype._toolbarDragStart): 43 (WebInspector.Toolbar.prototype._toolbarDrag): 44 * inspector/front-end/WebKit.qrc: 45 * inspector/front-end/externs.js: 46 (WebInspector.toggleSearchingForNode): 47 * inspector/front-end/inspector.css: 48 (body.undocked.platform-mac-snowleopard #toolbar): 49 (body.undocked.platform-mac-snowleopard #toolbar-dropdown): 50 * inspector/front-end/inspector.html: 51 * inspector/front-end/inspector.js: 52 (WebInspector._createGlobalStatusBarItems): 53 (windowLoaded): 54 (WebInspector.setDockingUnavailable): 55 * inspector/front-end/inspectorCommon.css: 56 (body.dock-to-right:not(.undocked)): 57 (body.dock-to-right.inactive:not(.undocked)): 58 1 59 2012-10-03 Vsevolod Vlasov <vsevik@chromium.org> 2 60 -
trunk/Source/WebCore/WebCore.gypi
r130260 r130288 6348 6348 'inspector/front-end/DOMStorage.js', 6349 6349 'inspector/front-end/DOMSyntaxHighlighter.js', 6350 'inspector/front-end/DockController.js', 6350 6351 'inspector/front-end/Drawer.js', 6351 6352 'inspector/front-end/ElementsPanelDescriptor.js', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r130081 r130288 76263 76263 </File> 76264 76264 <File 76265 RelativePath="..\inspector\front-end\DockController.js" 76266 > 76267 </File> 76268 <File 76265 76269 RelativePath="..\inspector\front-end\Drawer.js" 76266 76270 > -
trunk/Source/WebCore/inspector/compile-front-end.py
r130149 r130288 341 341 "dependencies": ["ui"], 342 342 "sources": [ 343 "InspectorFrontendAPI.js", 343 344 "InspectorFrontendHostStub.js", 345 ] 346 }, 347 { 348 "name": "inspector", 349 "dependencies": ["components"], 350 "sources": [ 351 "DockController.js", 344 352 ] 345 353 }, -
trunk/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js
r129348 r130288 29 29 */ 30 30 31 InspectorFrontendAPI = {31 var InspectorFrontendAPI = { 32 32 _pendingCommands: [], 33 33 … … 77 77 setAttachedWindow: function(attached) 78 78 { 79 WebInspector.attached = attached; 79 if (WebInspector.dockController) 80 WebInspector.dockController.setDocked(attached); 80 81 }, 81 82 -
trunk/Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js
r130149 r130288 71 71 requestAttachWindow: function() 72 72 { 73 InspectorFrontendAPI.setAttachedWindow(true); 73 74 }, 74 75 75 76 requestDetachWindow: function() 76 77 { 78 InspectorFrontendAPI.setAttachedWindow(false); 77 79 }, 78 80 -
trunk/Source/WebCore/inspector/front-end/Settings.js
r129861 r130288 93 93 this.deviceFitWindow = this.createSetting("deviceFitWindow", false); 94 94 this.showScriptFolders = this.createSetting("showScriptFolders", true); 95 this.dockToRight = this.createSetting("dockToRight", false);96 95 this.emulateTouchEvents = this.createSetting("emulateTouchEvents", false); 97 96 this.showPaintRects = this.createSetting("showPaintRects", false); … … 105 104 this.searchInContentScripts = this.createSetting("searchInContentScripts", false); 106 105 this.textEditorIndent = this.createSetting("textEditorIndent", " "); 106 this.lastDockState = this.createSetting("lastDockState", ""); 107 107 108 108 // If there are too many breakpoints in a storage, it is likely due to a recent bug that caused -
trunk/Source/WebCore/inspector/front-end/SettingsScreen.js
r130149 r130288 251 251 252 252 var p = this._appendSection(); 253 if (Preferences.showDockToRight)254 p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Dock to right"), WebInspector.settings.dockToRight));255 253 if (Preferences.exposeDisableCache) 256 254 p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Disable cache"), WebInspector.settings.cacheDisabled)); -
trunk/Source/WebCore/inspector/front-end/StatusBarButton.js
r130149 r130288 58 58 59 59 this.title = title; 60 this.className = className; 60 61 this.disabled = false; 61 62 this._visible = true; … … 193 194 { 194 195 var buttons = buttonsProvider(); 196 var mainButtonClone = new WebInspector.StatusBarButton(this.title, this.className, this.states); 197 mainButtonClone.addEventListener("click", this._clicked, this); 198 mainButtonClone.state = this.state; 199 buttons.push(mainButtonClone); 195 200 196 201 var mouseUpListener = mouseUp.bind(this); … … 206 211 var boundMouseOut = mouseOut.bind(this); 207 212 for (var i = 0; i < buttons.length; ++i) { 208 buttons[i].element.addEventListener("mousemove", boundMouseOver .bind(this), false);209 buttons[i].element.addEventListener("mouseout", boundMouseOut .bind(this), false);213 buttons[i].element.addEventListener("mousemove", boundMouseOver, false); 214 buttons[i].element.addEventListener("mouseout", boundMouseOut, false); 210 215 optionsBarElement.appendChild(buttons[i].element); 211 216 } -
trunk/Source/WebCore/inspector/front-end/Toolbar.js
r126268 r130288 36 36 { 37 37 this.element = document.getElementById("toolbar"); 38 WebInspector.installDragHandle(this.element, this._toolbarDragStart.bind(this), this._toolbarDrag.bind(this), this._toolbarDragEnd.bind(this), (WebInspector.isCompactMode() ? "row-resize" : "default"));38 WebInspector.installDragHandle(this.element, this._toolbarDragStart.bind(this), this._toolbarDrag.bind(this), this._toolbarDragEnd.bind(this), "default"); 39 39 40 40 this._dropdownButton = document.getElementById("toolbar-dropdown-arrow"); … … 98 98 99 99 /** 100 * @param {boolean} isCompactMode 101 */ 102 setCompactMode: function(isCompactMode) 103 { 104 this._isCompactMode = isCompactMode; 105 }, 106 107 /** 100 108 * @return {boolean} 101 109 */ 102 110 _toolbarDragStart: function(event) 103 111 { 104 if ((! WebInspector.isCompactMode()&& WebInspector.platformFlavor() !== WebInspector.PlatformFlavor.MacLeopard && WebInspector.platformFlavor() !== WebInspector.PlatformFlavor.MacSnowLeopard) || WebInspector.port() == "qt")112 if ((!this._isCompactMode && WebInspector.platformFlavor() !== WebInspector.PlatformFlavor.MacLeopard && WebInspector.platformFlavor() !== WebInspector.PlatformFlavor.MacSnowLeopard) || WebInspector.port() == "qt") 105 113 return false; 106 114 … … 125 133 _toolbarDrag: function(event) 126 134 { 127 if ( WebInspector.isCompactMode()) {135 if (this._isCompactMode) { 128 136 var height = window.innerHeight - (event.screenY - this.element.lastScreenY); 129 137 -
trunk/Source/WebCore/inspector/front-end/WebKit.qrc
r129884 r130288 59 59 <file>DOMStorageItemsView.js</file> 60 60 <file>DOMSyntaxHighlighter.js</file> 61 <file>DockController.js</file> 61 62 <file>Drawer.js</file> 62 63 <file>ElementsPanel.js</file> -
trunk/Source/WebCore/inspector/front-end/externs.js
r130136 r130288 178 178 var WebInspector = {} 179 179 180 WebInspector.queryParamsObject = {} 181 WebInspector.toggleSearchingForNode = function() {} 180 182 WebInspector.panels = {}; 181 183 … … 264 266 WebInspector.inspectedPageDomain; 265 267 266 WebInspector.isCompactMode = function() { return false; }267 268 268 WebInspector.SourceJavaScriptTokenizer = {} 269 269 WebInspector.SourceJavaScriptTokenizer.Keywords = {} -
trunk/Source/WebCore/inspector/front-end/inspector.css
r129381 r130288 67 67 } 68 68 69 body. detached.platform-mac-leopard #toolbar,70 body. detached.platform-mac-snowleopard #toolbar {69 body.undocked.platform-mac-leopard #toolbar, 70 body.undocked.platform-mac-snowleopard #toolbar { 71 71 background: transparent; 72 72 } … … 195 195 } 196 196 197 body. detached.platform-mac-leopard #toolbar-dropdown,198 body. detached.platform-mac-snowleopard #toolbar-dropdown {197 body.undocked.platform-mac-leopard #toolbar-dropdown, 198 body.undocked.platform-mac-snowleopard #toolbar-dropdown { 199 199 background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(191, 191, 191)), to(rgb(151, 151, 151))); 200 200 } -
trunk/Source/WebCore/inspector/front-end/inspector.html
r129884 r130288 168 168 <script type="text/javascript" src="NetworkPanelDescriptor.js"></script> 169 169 <script type="text/javascript" src="ScriptsPanelDescriptor.js"></script> 170 <script type="text/javascript" src="DockController.js"></script> 170 171 </head> 171 <body class=" detached" id="-webkit-web-inspector">172 <body class="undocked" id="-webkit-web-inspector"> 172 173 <div id="toolbar"> 173 174 <div class="toolbar-item close-left"><button id="close-button-left"></button></div> -
trunk/Source/WebCore/inspector/front-end/inspector.js
r130016 r130288 73 73 { 74 74 var bottomStatusBarContainer = document.getElementById("bottom-status-bar-container"); 75 this._dockToggleButton = new WebInspector.StatusBarButton("", "dock-status-bar-item", 3); 76 this._dockToggleButton.makeLongClickEnabled(this._createDockOptions.bind(this)); 77 this._dockToggleButton.addEventListener("click", this._toggleAttach.bind(this), false); 78 this._updateDockButtonState(); 79 75 76 // Create main dock button and options. 80 77 var mainStatusBar = document.getElementById("main-status-bar"); 81 mainStatusBar.insertBefore(this. _dockToggleButton.element, bottomStatusBarContainer);78 mainStatusBar.insertBefore(this.dockController.element, bottomStatusBarContainer); 82 79 83 80 this._toggleConsoleButton = new WebInspector.StatusBarButton(WebInspector.UIString("Show console."), "console-status-bar-item"); … … 92 89 93 90 mainStatusBar.appendChild(this.settingsController.statusBarItem); 94 },95 96 _createDockOptions: function()97 {98 var alternateDockToggleButton1 = new WebInspector.StatusBarButton("Dock to main window.", "dock-status-bar-item", 3);99 var alternateDockToggleButton2 = new WebInspector.StatusBarButton("Undock into separate window.", "dock-status-bar-item", 3);100 101 if (this.attached) {102 alternateDockToggleButton1.state = WebInspector.settings.dockToRight.get() ? "bottom" : "right";103 alternateDockToggleButton2.state = "undock";104 } else {105 alternateDockToggleButton1.state = WebInspector.settings.dockToRight.get() ? "bottom" : "right";106 alternateDockToggleButton2.state = WebInspector.settings.dockToRight.get() ? "right" : "bottom";107 }108 109 alternateDockToggleButton1.addEventListener("click", onClick.bind(this), false);110 alternateDockToggleButton2.addEventListener("click", onClick.bind(this), false);111 112 function onClick(e)113 {114 var state = e.target.state;115 if (state === "undock")116 this._toggleAttach();117 else if (state === "right") {118 if (!this.attached)119 this._toggleAttach();120 WebInspector.settings.dockToRight.set(true);121 } else if (state === "bottom") {122 if (!this.attached)123 this._toggleAttach();124 WebInspector.settings.dockToRight.set(false);125 }126 }127 128 return [alternateDockToggleButton1, alternateDockToggleButton2];129 },130 131 _updateDockButtonState: function()132 {133 if (!this._dockToggleButton)134 return;135 136 if (this.attached) {137 this._dockToggleButton.disabled = false;138 this._dockToggleButton.state = "undock";139 this._dockToggleButton.title = WebInspector.UIString("Undock into separate window.");140 } else {141 this._dockToggleButton.disabled = this._isDockingUnavailable;142 this._dockToggleButton.state = WebInspector.settings.dockToRight.get() ? "right" : "bottom";143 this._dockToggleButton.title = WebInspector.UIString("Dock to main window.");144 }145 },146 147 _toggleAttach: function()148 {149 if (!this._attached) {150 InspectorFrontendHost.requestAttachWindow();151 WebInspector.userMetrics.WindowDocked.record();152 } else {153 InspectorFrontendHost.requestDetachWindow();154 WebInspector.userMetrics.WindowUndocked.record();155 }156 91 }, 157 92 … … 222 157 delete this._drawerStatusBarHeader; 223 158 } 224 },225 226 get attached()227 {228 return this._attached;229 },230 231 set attached(x)232 {233 if (this._attached === x)234 return;235 236 this._attached = x;237 238 if (x)239 document.body.removeStyleClass("detached");240 else241 document.body.addStyleClass("detached");242 243 this._setCompactMode(x && !WebInspector.settings.dockToRight.get());244 this._updateDockButtonState();245 },246 247 isCompactMode: function()248 {249 return this.attached && !WebInspector.settings.dockToRight.get();250 },251 252 _setCompactMode: function(x)253 {254 var body = document.body;255 if (x)256 body.addStyleClass("compact");257 else258 body.removeStyleClass("compact");259 WebInspector.windowResize();260 159 }, 261 160 … … 408 307 { 409 308 InspectorBackend.loadFromJSONIfNeeded("../Inspector.json"); 309 WebInspector.dockController = new WebInspector.DockController(); 410 310 411 311 if (WebInspector.WorkerManager.isDedicatedWorkerFrontend()) { … … 534 434 this._createGlobalStatusBarItems(); 535 435 536 WebInspector._installDockToRight();537 538 436 this.toolbar = new WebInspector.Toolbar(); 539 437 WebInspector.startBatchUpdate(); … … 579 477 WebInspector.WorkerManager.loadCompleted(); 580 478 InspectorFrontendAPI.loadCompleted(); 581 }582 583 WebInspector._installDockToRight = function()584 {585 // Re-use Settings infrastructure for the dock-to-right settings UI586 WebInspector.settings.dockToRight.set(WebInspector.queryParamsObject.dockSide === "right");587 588 if (WebInspector.settings.dockToRight.get())589 document.body.addStyleClass("dock-to-right");590 591 if (WebInspector.attached)592 WebInspector._setCompactMode(!WebInspector.settings.dockToRight.get());593 594 WebInspector.settings.dockToRight.addChangeListener(listener.bind(this));595 596 function listener(event)597 {598 var value = WebInspector.settings.dockToRight.get();599 if (value) {600 InspectorFrontendHost.requestSetDockSide("right");601 document.body.addStyleClass("dock-to-right");602 } else {603 InspectorFrontendHost.requestSetDockSide("bottom");604 document.body.removeStyleClass("dock-to-right");605 }606 if (WebInspector.attached)607 WebInspector._setCompactMode(!value);608 else609 WebInspector._updateDockButtonState();610 }611 479 } 612 480 … … 623 491 WebInspector.loaded(); 624 492 625 WebInspector.attached = WebInspector.queryParamsObject.docked === "true";626 627 493 window.removeEventListener("DOMContentLoaded", windowLoaded, false); 628 494 delete windowLoaded; … … 669 535 WebInspector.setDockingUnavailable = function(unavailable) 670 536 { 671 this._isDockingUnavailable = unavailable;672 this._updateDockButtonState();537 if (this.dockController) 538 this.dockController.setDockingUnavailable(unavailable); 673 539 } 674 540 -
trunk/Source/WebCore/inspector/front-end/inspectorCommon.css
r122227 r130288 18 18 } 19 19 20 body.dock-to-right:not(. detached) {20 body.dock-to-right:not(.undocked) { 21 21 border-left: 1px solid rgb(80, 80, 80); 22 22 } 23 23 24 body.dock-to-right.inactive:not(. detached) {24 body.dock-to-right.inactive:not(.undocked) { 25 25 border-left: 1px solid rgb(64%, 64%, 64%); 26 26 }
Note:
See TracChangeset
for help on using the changeset viewer.