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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js

Issue 2377193004: [DevTools] Rework some focus code. (Closed)
Patch Set: FocusRestorer Created 4 years, 2 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) 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 10 *
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 { 971 {
972 this._warmedUpContent = content; 972 this._warmedUpContent = content;
973 } 973 }
974 }, 974 },
975 975
976 _shouldRenameOnMouseDown: function() 976 _shouldRenameOnMouseDown: function()
977 { 977 {
978 if (!this._uiSourceCode.canRename()) 978 if (!this._uiSourceCode.canRename())
979 return false; 979 return false;
980 var isSelected = this === this.treeOutline.selectedTreeElement; 980 var isSelected = this === this.treeOutline.selectedTreeElement;
981 var document = this.treeOutline.element.ownerDocument; 981 return isSelected && this.treeOutline.element.hasFocus() && !WebInspecto r.isBeingEdited(this.treeOutline.element);
982 var isFocused = this.treeOutline.element.isSelfOrAncestor(document.activ eElement);
983 return isSelected && isFocused && !WebInspector.isBeingEdited(this.treeO utline.element);
984 }, 982 },
985 983
986 selectOnMouseDown: function(event) 984 selectOnMouseDown: function(event)
987 { 985 {
988 if (event.which !== 1 || !this._shouldRenameOnMouseDown()) { 986 if (event.which !== 1 || !this._shouldRenameOnMouseDown()) {
989 TreeElement.prototype.selectOnMouseDown.call(this, event); 987 TreeElement.prototype.selectOnMouseDown.call(this, event);
990 return; 988 return;
991 } 989 }
992 setTimeout(rename.bind(this), 300); 990 setTimeout(rename.bind(this), 300);
993 991
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
1633 return; 1631 return;
1634 this._treeElement.listItemElement.classList.toggle("has-mapped-files", i sActive); 1632 this._treeElement.listItemElement.classList.toggle("has-mapped-files", i sActive);
1635 if (isActive) 1633 if (isActive)
1636 this._treeElement.expand(); 1634 this._treeElement.expand();
1637 else 1635 else
1638 this._treeElement.collapse(); 1636 this._treeElement.collapse();
1639 }, 1637 },
1640 1638
1641 __proto__: WebInspector.NavigatorTreeNode.prototype 1639 __proto__: WebInspector.NavigatorTreeNode.prototype
1642 } 1640 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698