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

Side by Side Diff: Source/devtools/front_end/ui/treeoutline.js

Issue 1313443005: DevTools: forward Up/Down keys to profiles sidebar from FlameChart (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: new approach Created 5 years, 3 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 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 { 179 {
180 if (!element.treeOutline) 180 if (!element.treeOutline)
181 console.error("Unbinding element that was not bound: " + new Error() .stack); 181 console.error("Unbinding element that was not bound: " + new Error() .stack);
182 182
183 element.deselect(); 183 element.deselect();
184 element.onunbind(); 184 element.onunbind();
185 element.treeOutline = null; 185 element.treeOutline = null;
186 }, 186 },
187 187
188 /** 188 /**
189 * @return {boolean}
190 */
191 selectPrevious: function()
192 {
193 var nextSelectedElement = this.selectedTreeElement.traversePreviousTreeE lement(true);
194 while (nextSelectedElement && !nextSelectedElement.selectable)
195 nextSelectedElement = nextSelectedElement.traversePreviousTreeElemen t(!this.expandTreeElementsWhenArrowing);
196 if (nextSelectedElement) {
197 nextSelectedElement.reveal();
198 nextSelectedElement.select(false, true);
199 return true;
200 }
201 return false;
202 },
203
204 /**
205 * @return {boolean}
206 */
207 selectNext: function()
208 {
209 var nextSelectedElement = this.selectedTreeElement.traverseNextTreeEleme nt(true);
210 while (nextSelectedElement && !nextSelectedElement.selectable)
211 nextSelectedElement = nextSelectedElement.traverseNextTreeElement(!t his.expandTreeElementsWhenArrowing);
212 if (nextSelectedElement) {
213 nextSelectedElement.reveal();
214 nextSelectedElement.select(false, true);
215 return true;
216 }
217 return false;
218 },
219
220 /**
189 * @param {!Event} event 221 * @param {!Event} event
190 */ 222 */
191 _treeKeyDown: function(event) 223 _treeKeyDown: function(event)
192 { 224 {
193 if (event.target !== this._contentElement) 225 if (event.target !== this._contentElement)
194 return; 226 return;
195 227
196 if (!this.selectedTreeElement || event.shiftKey || event.metaKey || even t.ctrlKey) 228 if (!this.selectedTreeElement || event.shiftKey || event.metaKey || even t.ctrlKey)
197 return; 229 return;
198 230
199 var handled = false; 231 var handled = false;
200 var nextSelectedElement; 232 var nextSelectedElement;
201 if (event.keyIdentifier === "Up" && !event.altKey) { 233 if (event.keyIdentifier === "Up" && !event.altKey) {
202 nextSelectedElement = this.selectedTreeElement.traversePreviousTreeE lement(true); 234 handled = this.selectPrevious();
203 while (nextSelectedElement && !nextSelectedElement.selectable)
204 nextSelectedElement = nextSelectedElement.traversePreviousTreeEl ement(!this.expandTreeElementsWhenArrowing);
205 handled = nextSelectedElement ? true : false;
206 } else if (event.keyIdentifier === "Down" && !event.altKey) { 235 } else if (event.keyIdentifier === "Down" && !event.altKey) {
207 nextSelectedElement = this.selectedTreeElement.traverseNextTreeEleme nt(true); 236 handled = this.selectNext();
208 while (nextSelectedElement && !nextSelectedElement.selectable)
209 nextSelectedElement = nextSelectedElement.traverseNextTreeElemen t(!this.expandTreeElementsWhenArrowing);
210 handled = nextSelectedElement ? true : false;
211 } else if (event.keyIdentifier === "Left") { 237 } else if (event.keyIdentifier === "Left") {
212 if (this.selectedTreeElement.expanded) { 238 if (this.selectedTreeElement.expanded) {
213 if (event.altKey) 239 if (event.altKey)
214 this.selectedTreeElement.collapseRecursively(); 240 this.selectedTreeElement.collapseRecursively();
215 else 241 else
216 this.selectedTreeElement.collapse(); 242 this.selectedTreeElement.collapse();
217 handled = true; 243 handled = true;
218 } else if (this.selectedTreeElement.parent && !this.selectedTreeElem ent.parent.root) { 244 } else if (this.selectedTreeElement.parent && !this.selectedTreeElem ent.parent.root) {
219 handled = true; 245 handled = true;
220 if (this.selectedTreeElement.parent.selectable) { 246 if (this.selectedTreeElement.parent.selectable) {
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 isEventWithinDisclosureTriangle: function(event) 1094 isEventWithinDisclosureTriangle: function(event)
1069 { 1095 {
1070 // FIXME: We should not use getComputedStyle(). For that we need to get rid of using ::before for disclosure triangle. (http://webk.it/74446) 1096 // FIXME: We should not use getComputedStyle(). For that we need to get rid of using ::before for disclosure triangle. (http://webk.it/74446)
1071 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddi ngLeft; 1097 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddi ngLeft;
1072 console.assert(paddingLeftValue.endsWith("px")); 1098 console.assert(paddingLeftValue.endsWith("px"));
1073 var computedLeftPadding = parseFloat(paddingLeftValue); 1099 var computedLeftPadding = parseFloat(paddingLeftValue);
1074 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; 1100 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding;
1075 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo ggleWidth && this._expandable; 1101 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo ggleWidth && this._expandable;
1076 } 1102 }
1077 } 1103 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/profiler/ProfilesPanel.js ('k') | Source/devtools/front_end/ui_lazy/FlameChart.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698