| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 /** | 107 /** |
| 108 * @return {boolean} | 108 * @return {boolean} |
| 109 */ | 109 */ |
| 110 isVertical: function() | 110 isVertical: function() |
| 111 { | 111 { |
| 112 return this._dockSide === WebInspector.DockController.State.DockedToRigh
t; | 112 return this._dockSide === WebInspector.DockController.State.DockedToRigh
t; |
| 113 }, | 113 }, |
| 114 | 114 |
| 115 /** | 115 /** |
| 116 * @param {string} dockSide | 116 * @param {string} dockSide |
| 117 * @suppressGlobalPropertiesCheck |
| 117 */ | 118 */ |
| 118 setDockSide: function(dockSide) | 119 setDockSide: function(dockSide) |
| 119 { | 120 { |
| 120 if (this._states.indexOf(dockSide) === -1) | 121 if (this._states.indexOf(dockSide) === -1) |
| 121 dockSide = this._states[0]; | 122 dockSide = this._states[0]; |
| 122 | 123 |
| 123 if (this._dockSide === dockSide) | 124 if (this._dockSide === dockSide) |
| 124 return; | 125 return; |
| 125 | 126 |
| 126 if (this._dockSide) | 127 if (this._dockSide) |
| 127 this._lastDockStateSetting.set(this._dockSide); | 128 this._lastDockStateSetting.set(this._dockSide); |
| 128 | 129 |
| 129 WebInspector.DockController._previousFocusedElement = WebInspector.curre
ntFocusElement(); | 130 this._savedFocus = document.deepActiveElement(); |
| 130 var eventData = { from: this._dockSide, to: dockSide }; | 131 var eventData = { from: this._dockSide, to: dockSide }; |
| 131 this.dispatchEventToListeners(WebInspector.DockController.Events.BeforeD
ockSideChanged, eventData); | 132 this.dispatchEventToListeners(WebInspector.DockController.Events.BeforeD
ockSideChanged, eventData); |
| 132 console.timeStamp("DockController.setIsDocked"); | 133 console.timeStamp("DockController.setIsDocked"); |
| 133 this._dockSide = dockSide; | 134 this._dockSide = dockSide; |
| 134 this._currentDockStateSetting.set(dockSide); | 135 this._currentDockStateSetting.set(dockSide); |
| 135 InspectorFrontendHost.setIsDocked(dockSide !== WebInspector.DockControll
er.State.Undocked, this._setIsDockedResponse.bind(this, eventData)); | 136 InspectorFrontendHost.setIsDocked(dockSide !== WebInspector.DockControll
er.State.Undocked, this._setIsDockedResponse.bind(this, eventData)); |
| 136 this._updateUI(); | 137 this._updateUI(); |
| 137 this.dispatchEventToListeners(WebInspector.DockController.Events.DockSid
eChanged, eventData); | 138 this.dispatchEventToListeners(WebInspector.DockController.Events.DockSid
eChanged, eventData); |
| 138 }, | 139 }, |
| 139 | 140 |
| 140 /** | 141 /** |
| 141 * @param {{from: string, to: string}} eventData | 142 * @param {{from: string, to: string}} eventData |
| 143 * @suppressGlobalPropertiesCheck |
| 142 */ | 144 */ |
| 143 _setIsDockedResponse: function(eventData) | 145 _setIsDockedResponse: function(eventData) |
| 144 { | 146 { |
| 145 this.dispatchEventToListeners(WebInspector.DockController.Events.AfterDo
ckSideChanged, eventData); | 147 this.dispatchEventToListeners(WebInspector.DockController.Events.AfterDo
ckSideChanged, eventData); |
| 146 | 148 if (this._savedFocus) { |
| 147 if (WebInspector.DockController._previousFocusedElement) | 149 this._savedFocus.focus(); |
| 148 WebInspector.DockController._previousFocusedElement.focus(); | 150 this._savedFocus = null; |
| 149 delete WebInspector.DockController._previousFocusedElement; | 151 } |
| 150 }, | 152 }, |
| 151 | 153 |
| 152 /** | 154 /** |
| 153 * @suppressGlobalPropertiesCheck | 155 * @suppressGlobalPropertiesCheck |
| 154 */ | 156 */ |
| 155 _updateUI: function() | 157 _updateUI: function() |
| 156 { | 158 { |
| 157 var body = document.body; // Only for main window. | 159 var body = document.body; // Only for main window. |
| 158 switch (this._dockSide) { | 160 switch (this._dockSide) { |
| 159 case WebInspector.DockController.State.DockedToBottom: | 161 case WebInspector.DockController.State.DockedToBottom: |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 item: function() | 227 item: function() |
| 226 { | 228 { |
| 227 return WebInspector.dockController._closeButton; | 229 return WebInspector.dockController._closeButton; |
| 228 } | 230 } |
| 229 } | 231 } |
| 230 | 232 |
| 231 /** | 233 /** |
| 232 * @type {!WebInspector.DockController} | 234 * @type {!WebInspector.DockController} |
| 233 */ | 235 */ |
| 234 WebInspector.dockController; | 236 WebInspector.dockController; |
| OLD | NEW |