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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js

Issue 2016963002: DevTools: rework focus logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove stray newline Created 4 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com).
5 * Copyright (C) 2009 Joseph Pecoraro 5 * Copyright (C) 2009 Joseph Pecoraro
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 10 *
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 this._zIndex = WebInspector._glassPane ? WebInspector._glassPane._zIndex + 1 000 : 3000; // Deliberately starts with 3000 to hide other z-indexed elements be low. 283 this._zIndex = WebInspector._glassPane ? WebInspector._glassPane._zIndex + 1 000 : 3000; // Deliberately starts with 3000 to hide other z-indexed elements be low.
284 this.element.style.cssText = "position:absolute;top:0;bottom:0;left:0;right: 0;background-color:" + background + ";z-index:" + this._zIndex + ";overflow:hidd en;"; 284 this.element.style.cssText = "position:absolute;top:0;bottom:0;left:0;right: 0;background-color:" + background + ";z-index:" + this._zIndex + ";overflow:hidd en;";
285 document.body.appendChild(this.element); 285 document.body.appendChild(this.element);
286 WebInspector._glassPane = this; 286 WebInspector._glassPane = this;
287 } 287 }
288 288
289 WebInspector.GlassPane.prototype = { 289 WebInspector.GlassPane.prototype = {
290 dispose: function() 290 dispose: function()
291 { 291 {
292 delete WebInspector._glassPane; 292 delete WebInspector._glassPane;
293 if (WebInspector.GlassPane.DefaultFocusedViewStack.length)
294 WebInspector.GlassPane.DefaultFocusedViewStack.peekLast().focus();
295 this.element.remove(); 293 this.element.remove();
296 } 294 }
297 } 295 }
298 296
299 /** @type {!WebInspector.GlassPane|undefined} */ 297 /** @type {!WebInspector.GlassPane|undefined} */
300 WebInspector._glassPane; 298 WebInspector._glassPane;
301 299
302 /** 300 /**
303 * @type {!Array.<!WebInspector.Widget|!WebInspector.Dialog>}
304 */
305 WebInspector.GlassPane.DefaultFocusedViewStack = [];
306
307 /**
308 * @param {?Node=} node 301 * @param {?Node=} node
309 * @return {boolean} 302 * @return {boolean}
310 */ 303 */
311 WebInspector.isBeingEdited = function(node) 304 WebInspector.isBeingEdited = function(node)
312 { 305 {
313 if (!node || node.nodeType !== Node.ELEMENT_NODE) 306 if (!node || node.nodeType !== Node.ELEMENT_NODE)
314 return false; 307 return false;
315 var element = /** {!Element} */ (node); 308 var element = /** {!Element} */ (node);
316 if (element.classList.contains("text-prompt") || element.nodeName === "INPUT " || element.nodeName === "TEXTAREA") 309 if (element.classList.contains("text-prompt") || element.nodeName === "INPUT " || element.nodeName === "TEXTAREA")
317 return true; 310 return true;
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 /** 1617 /**
1625 * @param {string} value 1618 * @param {string} value
1626 */ 1619 */
1627 function setValue(value) 1620 function setValue(value)
1628 { 1621 {
1629 if (value === input.value) 1622 if (value === input.value)
1630 return; 1623 return;
1631 var valid = validate(value); 1624 var valid = validate(value);
1632 input.classList.toggle("error-input", !valid); 1625 input.classList.toggle("error-input", !valid);
1633 input.value = value; 1626 input.value = value;
1634
1635 // Selection range operations are not supported by type "number" inputs. This browser
1636 // behavior is detailed by the WHATWG forms spec.
1637 if (input.type !== "number")
1638 input.setSelectionRange(value.length, value.length);
1639 } 1627 }
1640 1628
1641 return setValue; 1629 return setValue;
1642 } 1630 }
1643 1631
1644 /** 1632 /**
1645 * @constructor 1633 * @constructor
1646 */ 1634 */
1647 WebInspector.StringFormatter = function() 1635 WebInspector.StringFormatter = function()
1648 { 1636 {
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1990 * @param {string} title 1978 * @param {string} title
1991 * @return {!Element} 1979 * @return {!Element}
1992 */ 1980 */
1993 WebInspector.linkifyDocumentationURLAsNode = function(article, title) 1981 WebInspector.linkifyDocumentationURLAsNode = function(article, title)
1994 { 1982 {
1995 return WebInspector.linkifyURLAsNode("https://developers.google.com/web/tool s/chrome-devtools/" + article, title, undefined, true); 1983 return WebInspector.linkifyURLAsNode("https://developers.google.com/web/tool s/chrome-devtools/" + article, title, undefined, true);
1996 } 1984 }
1997 1985
1998 /** @type {!WebInspector.ThemeSupport} */ 1986 /** @type {!WebInspector.ThemeSupport} */
1999 WebInspector.themeSupport; 1987 WebInspector.themeSupport;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698