OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 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. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 this.element.appendChild(this._drawerContentsElement); | 48 this.element.appendChild(this._drawerContentsElement); |
49 this._viewStatusBar = document.createElement("div"); | 49 this._viewStatusBar = document.createElement("div"); |
50 this._viewStatusBar.addEventListener("webkitTransitionEnd", this.immediately
FinishAnimation.bind(this), false); | 50 this._viewStatusBar.addEventListener("webkitTransitionEnd", this.immediately
FinishAnimation.bind(this), false); |
51 this._viewStatusBar.style.opacity = 0; | 51 this._viewStatusBar.style.opacity = 0; |
52 this._bottomStatusBar = document.getElementById("bottom-status-bar-container
"); | 52 this._bottomStatusBar = document.getElementById("bottom-status-bar-container
"); |
53 | 53 |
54 var drawerIsOverlay = WebInspector.experimentsSettings.drawerOverlay.isEnabl
ed(); | 54 var drawerIsOverlay = WebInspector.experimentsSettings.drawerOverlay.isEnabl
ed(); |
55 this._elementToAdjust = drawerIsOverlay ? this._floatingStatusBarContainer
: this._mainElement; | 55 this._elementToAdjust = drawerIsOverlay ? this._floatingStatusBarContainer
: this._mainElement; |
56 | 56 |
57 document.body.enableStyleClass("drawer-overlay", drawerIsOverlay); | 57 document.body.enableStyleClass("drawer-overlay", drawerIsOverlay); |
| 58 |
| 59 if (drawerIsOverlay) { |
| 60 this._floatingStatusBarContainer.addEventListener("focusin", this._onFoc
us.bind(this)); |
| 61 this._floatingStatusBarContainer.addEventListener("focusout", this._onBl
ur.bind(this)); |
| 62 |
| 63 this.element.addEventListener("focusin", this._onFocus.bind(this)); |
| 64 this.element.addEventListener("focusout", this._onBlur.bind(this)); |
| 65 } |
58 } | 66 } |
59 | 67 |
60 WebInspector.Drawer.AnimationType = { | 68 WebInspector.Drawer.AnimationType = { |
61 Immediately: 0, | 69 Immediately: 0, |
62 Normal: 1, | 70 Normal: 1, |
63 Slow: 2 | 71 Slow: 2 |
64 } | 72 } |
65 | 73 |
66 WebInspector.Drawer.prototype = { | 74 WebInspector.Drawer.prototype = { |
67 get visible() | 75 get visible() |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 this._viewStatusBar.style.opacity = 0; | 185 this._viewStatusBar.style.opacity = 0; |
178 } | 186 } |
179 | 187 |
180 if (animationType === WebInspector.Drawer.AnimationType.Immediately) { | 188 if (animationType === WebInspector.Drawer.AnimationType.Immediately) { |
181 adjustStyles.call(this); | 189 adjustStyles.call(this); |
182 this.immediatelyFinishAnimation(); | 190 this.immediatelyFinishAnimation(); |
183 } else | 191 } else |
184 setTimeout(adjustStyles.bind(this), 0); | 192 setTimeout(adjustStyles.bind(this), 0); |
185 }, | 193 }, |
186 | 194 |
| 195 _onFocus: function(event) |
| 196 { |
| 197 if (this._closeTimeout) { |
| 198 clearTimeout(this._closeTimeout); |
| 199 delete this._closeTimeout; |
| 200 } |
| 201 }, |
| 202 |
| 203 _onBlur: function(event) |
| 204 { |
| 205 if (this._closeTimeout) |
| 206 clearTimeout(this._closeTimeout); |
| 207 this._closeTimeout = setTimeout( WebInspector.closeDrawer.bind(WebInspec
tor, WebInspector.Drawer.AnimationType.Normal), 0); |
| 208 }, |
| 209 |
187 resize: function() | 210 resize: function() |
188 { | 211 { |
189 if (!this.visible) | 212 if (!this.visible) |
190 return; | 213 return; |
191 | 214 |
192 this._view.storeScrollPositions(); | 215 this._view.storeScrollPositions(); |
193 var height = this._constrainHeight(parseInt(this.element.style.height, 1
0)); | 216 var height = this._constrainHeight(parseInt(this.element.style.height, 1
0)); |
194 this._elementToAdjust.style.bottom = height + "px"; | 217 this._elementToAdjust.style.bottom = height + "px"; |
195 this.element.style.height = height + "px"; | 218 this.element.style.height = height + "px"; |
196 this._view.doResize(); | 219 this._view.doResize(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 this._view.doResize(); | 266 this._view.doResize(); |
244 | 267 |
245 event.consume(true); | 268 event.consume(true); |
246 }, | 269 }, |
247 | 270 |
248 _endStatusBarDragging: function(event) | 271 _endStatusBarDragging: function(event) |
249 { | 272 { |
250 this._savedHeight = this.element.offsetHeight; | 273 this._savedHeight = this.element.offsetHeight; |
251 delete this._statusBarDragOffset; | 274 delete this._statusBarDragOffset; |
252 | 275 |
253 event.consume(); | 276 event.consume(true); |
254 } | 277 } |
255 } | 278 } |
256 | 279 |
257 /** | 280 /** |
258 * @type {WebInspector.Drawer} | 281 * @type {WebInspector.Drawer} |
259 */ | 282 */ |
260 WebInspector.drawer = null; | 283 WebInspector.drawer = null; |
OLD | NEW |