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

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: Fixed comments. Created 7 years, 7 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
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
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
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;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698