Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: Source/devtools/front_end/Drawer.js

Issue 14329024: [DevTools] Close drawer on blur after short timeout. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Close drawer only in overlay mode. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
68 WebInspector.Drawer._overlayCloseTimeout = 500;
pfeldman 2013/04/27 08:05:45 Why is there a timeout?
Dmitry Zvorygin 2013/04/29 16:02:35 Removed. Actually works fine even without timeout,
69
60 WebInspector.Drawer.AnimationType = { 70 WebInspector.Drawer.AnimationType = {
61 Immediately: 0, 71 Immediately: 0,
62 Normal: 1, 72 Normal: 1,
63 Slow: 2 73 Slow: 2
64 } 74 }
65 75
66 WebInspector.Drawer.prototype = { 76 WebInspector.Drawer.prototype = {
67 get visible() 77 get visible()
68 { 78 {
69 return !!this._view; 79 return !!this._view;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 this._viewStatusBar.style.opacity = 0; 187 this._viewStatusBar.style.opacity = 0;
178 } 188 }
179 189
180 if (animationType === WebInspector.Drawer.AnimationType.Immediately) { 190 if (animationType === WebInspector.Drawer.AnimationType.Immediately) {
181 adjustStyles.call(this); 191 adjustStyles.call(this);
182 this.immediatelyFinishAnimation(); 192 this.immediatelyFinishAnimation();
183 } else 193 } else
184 setTimeout(adjustStyles.bind(this), 0); 194 setTimeout(adjustStyles.bind(this), 0);
185 }, 195 },
186 196
197 _onFocus: function(event)
198 {
199 if (this._closeTimeout) {
200 clearTimeout(this._closeTimeout);
201 delete this._closeTimeout;
202 }
203 },
204
205 _onBlur: function(event)
206 {
207 if (this._closeTimeout)
208 clearTimeout(this._closeTimeout);
209 this._closeTimeout = setTimeout( WebInspector.closeDrawer.bind(WebInspec tor, WebInspector.Drawer.AnimationType.Normal), WebInspector.Drawer._overlayClos eTimeout);
210 },
211
187 resize: function() 212 resize: function()
188 { 213 {
189 if (!this.visible) 214 if (!this.visible)
190 return; 215 return;
191 216
192 this._view.storeScrollPositions(); 217 this._view.storeScrollPositions();
193 var height = this._constrainHeight(parseInt(this.element.style.height, 1 0)); 218 var height = this._constrainHeight(parseInt(this.element.style.height, 1 0));
194 this._elementToAdjust.style.bottom = height + "px"; 219 this._elementToAdjust.style.bottom = height + "px";
195 this.element.style.height = height + "px"; 220 this.element.style.height = height + "px";
196 this._view.doResize(); 221 this._view.doResize();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 this._view.doResize(); 268 this._view.doResize();
244 269
245 event.consume(true); 270 event.consume(true);
246 }, 271 },
247 272
248 _endStatusBarDragging: function(event) 273 _endStatusBarDragging: function(event)
249 { 274 {
250 this._savedHeight = this.element.offsetHeight; 275 this._savedHeight = this.element.offsetHeight;
251 delete this._statusBarDragOffset; 276 delete this._statusBarDragOffset;
252 277
253 event.consume(); 278 event.consume(true);
254 } 279 }
255 } 280 }
256 281
257 /** 282 /**
258 * @type {WebInspector.Drawer} 283 * @type {WebInspector.Drawer}
259 */ 284 */
260 WebInspector.drawer = null; 285 WebInspector.drawer = null;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698