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

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

Issue 2033403005: Eradicate keyIndentifier from devtools/* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Call KeyCodeToKeyIdentifier for unhandle key events 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) 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 _treeKeyDown: function(event) 224 _treeKeyDown: function(event)
225 { 225 {
226 if (event.target !== this.contentElement) 226 if (event.target !== this.contentElement)
227 return; 227 return;
228 228
229 if (!this.selectedTreeElement || event.shiftKey || event.metaKey || even t.ctrlKey) 229 if (!this.selectedTreeElement || event.shiftKey || event.metaKey || even t.ctrlKey)
230 return; 230 return;
231 231
232 var handled = false; 232 var handled = false;
233 var nextSelectedElement; 233 var nextSelectedElement;
234 if (event.keyIdentifier === "Up" && !event.altKey) { 234 if (event.key === "ArrowUp" && !event.altKey) {
235 handled = this.selectPrevious(); 235 handled = this.selectPrevious();
236 } else if (event.keyIdentifier === "Down" && !event.altKey) { 236 } else if (event.key === "ArrowDown" && !event.altKey) {
237 handled = this.selectNext(); 237 handled = this.selectNext();
238 } else if (event.keyIdentifier === "Left") { 238 } else if (event.key === "ArrowLeft") {
239 if (this.selectedTreeElement.expanded) { 239 if (this.selectedTreeElement.expanded) {
240 if (event.altKey) 240 if (event.altKey)
241 this.selectedTreeElement.collapseRecursively(); 241 this.selectedTreeElement.collapseRecursively();
242 else 242 else
243 this.selectedTreeElement.collapse(); 243 this.selectedTreeElement.collapse();
244 handled = true; 244 handled = true;
245 } else if (this.selectedTreeElement.parent && !this.selectedTreeElem ent.parent.root) { 245 } else if (this.selectedTreeElement.parent && !this.selectedTreeElem ent.parent.root) {
246 handled = true; 246 handled = true;
247 if (this.selectedTreeElement.parent.selectable) { 247 if (this.selectedTreeElement.parent.selectable) {
248 nextSelectedElement = this.selectedTreeElement.parent; 248 nextSelectedElement = this.selectedTreeElement.parent;
249 while (nextSelectedElement && !nextSelectedElement.selectabl e) 249 while (nextSelectedElement && !nextSelectedElement.selectabl e)
250 nextSelectedElement = nextSelectedElement.parent; 250 nextSelectedElement = nextSelectedElement.parent;
251 handled = nextSelectedElement ? true : false; 251 handled = nextSelectedElement ? true : false;
252 } else if (this.selectedTreeElement.parent) 252 } else if (this.selectedTreeElement.parent)
253 this.selectedTreeElement.parent.collapse(); 253 this.selectedTreeElement.parent.collapse();
254 } 254 }
255 } else if (event.keyIdentifier === "Right") { 255 } else if (event.key === "ArrowRight") {
256 if (!this.selectedTreeElement.revealed()) { 256 if (!this.selectedTreeElement.revealed()) {
257 this.selectedTreeElement.reveal(); 257 this.selectedTreeElement.reveal();
258 handled = true; 258 handled = true;
259 } else if (this.selectedTreeElement._expandable) { 259 } else if (this.selectedTreeElement._expandable) {
260 handled = true; 260 handled = true;
261 if (this.selectedTreeElement.expanded) { 261 if (this.selectedTreeElement.expanded) {
262 nextSelectedElement = this.selectedTreeElement.firstChild(); 262 nextSelectedElement = this.selectedTreeElement.firstChild();
263 while (nextSelectedElement && !nextSelectedElement.selectabl e) 263 while (nextSelectedElement && !nextSelectedElement.selectabl e)
264 nextSelectedElement = nextSelectedElement.nextSibling; 264 nextSelectedElement = nextSelectedElement.nextSibling;
265 handled = nextSelectedElement ? true : false; 265 handled = nextSelectedElement ? true : false;
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 isEventWithinDisclosureTriangle: function(event) 1163 isEventWithinDisclosureTriangle: function(event)
1164 { 1164 {
1165 // FIXME: We should not use getComputedStyle(). For that we need to get rid of using ::before for disclosure triangle. (http://webk.it/74446) 1165 // FIXME: We should not use getComputedStyle(). For that we need to get rid of using ::before for disclosure triangle. (http://webk.it/74446)
1166 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddi ngLeft; 1166 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddi ngLeft;
1167 console.assert(paddingLeftValue.endsWith("px")); 1167 console.assert(paddingLeftValue.endsWith("px"));
1168 var computedLeftPadding = parseFloat(paddingLeftValue); 1168 var computedLeftPadding = parseFloat(paddingLeftValue);
1169 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; 1169 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding;
1170 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo ggleWidth && this._expandable; 1170 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo ggleWidth && this._expandable;
1171 } 1171 }
1172 } 1172 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698