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

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

Issue 1803813002: [DevTools] Added keyboard search while in sources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final code cleanup Created 4 years, 9 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 24 matching lines...) Expand all
35 { 35 {
36 this._createRootElement(); 36 this._createRootElement();
37 37
38 this.selectedTreeElement = null; 38 this.selectedTreeElement = null;
39 this.expandTreeElementsWhenArrowing = false; 39 this.expandTreeElementsWhenArrowing = false;
40 /** @type {?function(!TreeElement, !TreeElement):number} */ 40 /** @type {?function(!TreeElement, !TreeElement):number} */
41 this._comparator = null; 41 this._comparator = null;
42 42
43 this._contentElement = this._rootElement._childrenListNode; 43 this._contentElement = this._rootElement._childrenListNode;
44 this._contentElement.addEventListener("keydown", this._treeKeyDown.bind(this ), true); 44 this._contentElement.addEventListener("keydown", this._treeKeyDown.bind(this ), true);
45 this._contentElement.addEventListener("keypress", this._treeKeyPress.bind(th is), true);
45 46
46 this.setFocusable(!nonFocusable); 47 this.setFocusable(!nonFocusable);
47 48
48 this.element = this._contentElement; 49 this.element = this._contentElement;
50
51 this.element.addEventListener("blur", this._handleBlur.bind(this), true);
52 this.element.addEventListener("click", this._handleClick.bind(this), true);
49 } 53 }
50 54
51 TreeOutline.Events = { 55 TreeOutline.Events = {
52 ElementAttached: "ElementAttached", 56 ElementAttached: "ElementAttached",
53 ElementExpanded: "ElementExpanded", 57 ElementExpanded: "ElementExpanded",
54 ElementCollapsed: "ElementCollapsed", 58 ElementCollapsed: "ElementCollapsed",
55 ElementSelected: "ElementSelected" 59 ElementSelected: "ElementSelected"
56 } 60 }
57 61
58 TreeOutline.prototype = { 62 TreeOutline.prototype = {
59 _createRootElement: function() 63 _createRootElement: function()
60 { 64 {
61 this._rootElement = new TreeElement(); 65 this._rootElement = new TreeElement();
62 this._rootElement.treeOutline = this; 66 this._rootElement.treeOutline = this;
63 this._rootElement.root = true; 67 this._rootElement.root = true;
64 this._rootElement.selectable = false; 68 this._rootElement.selectable = false;
65 this._rootElement.expanded = true; 69 this._rootElement.expanded = true;
66 this._rootElement._childrenListNode.classList.remove("children"); 70 this._rootElement._childrenListNode.classList.remove("children");
71
72 this._currentSelectionFilterString = '';
pfeldman 2016/03/14 23:51:35 Please only use double quotes.
Allada-Google 2016/03/15 17:13:08 Done.
73 this._currentSelectionFilter = null;
pfeldman 2016/03/14 23:51:34 You should declare a type here using JSDoc.
Allada-Google 2016/03/15 17:13:07 Done.
74 this._highlightChanges = [];
75 this._interactiveFilterEnabled = false;
67 }, 76 },
68 77
69 /** 78 /**
70 * @return {!TreeElement} 79 * @return {!TreeElement}
71 */ 80 */
72 rootElement: function() 81 rootElement: function()
73 { 82 {
74 return this._rootElement; 83 return this._rootElement;
75 }, 84 },
76 85
77 /** 86 /**
87 * This will also set/override the RegExp to filter on (ie: setCurrentSelect ionFilter())
pfeldman 2016/03/14 23:51:34 We don't explain why (in Blink)...
Allada-Google 2016/03/15 17:13:08 Done.
88 * @param {string} filterString String to filter text on.
pfeldman 2016/03/14 23:51:35 or what... Just the types.
Allada-Google 2016/03/15 17:13:08 Done.
89 */
90 setCurrentSelectionFilterString: function (filterString)
pfeldman 2016/03/14 23:51:35 Seems to be private (starts with _)
Allada-Google 2016/03/15 17:13:08 Done.
91 {
92 this._currentSelectionFilterString = filterString;
93 if (this._currentSelectionFilterString === '')
pfeldman 2016/03/14 23:51:34 ""
Allada-Google 2016/03/15 17:13:08 Done.
94 this.setCurrentSelectionFilter(null);
95 else
96 this.setCurrentSelectionFilter(new RegExp(['(', this._currentSelecti onFilterString.escapeForRegExp(), ')'].join(''), 'i'));
97 },
98
99 /**
100 * @return {string}
101 */
102 currentSelectionFilterString: function ()
pfeldman 2016/03/14 23:51:34 lets not expose until required.
Allada-Google 2016/03/15 17:13:08 Done.
103 {
104
105 return this._currentSelectionFilterString;
106 },
107
108 setInteractiveFilterable: function (enable)
pfeldman 2016/03/14 23:51:34 JSDoc for enable type.
Allada-Google 2016/03/15 17:13:07 Done.
109 {
110 this._interactiveFilterEnabled = !!enable;
pfeldman 2016/03/14 23:51:34 Declare it as a boolean and there would be no need
Allada-Google 2016/03/15 17:13:08 Done.
111 },
112
113 /**
114 * @param {?RegExp} filterRegExp Regular Expression to use to filter selecta ble items
115 */
116 setCurrentSelectionFilter: function (filterRegExp)
117 {
118 var currentFilter = this._currentSelectionFilter;
119 this._currentSelectionFilter = filterRegExp;
120
121 if (this._highlightChanges && this._highlightChanges.length > 0)
pfeldman 2016/03/14 23:51:34 (this._highlightChanges && this._highlightChanges.
Allada-Google 2016/03/15 17:13:08 Done.
122 WebInspector.revertDomChanges(this._highlightChanges);
pfeldman 2016/03/14 23:51:34 We are now vulnerable to the changes made to the e
Allada-Google 2016/03/15 17:13:08 Done.
123 this._highlightChanges = [];
124
125 if (filterRegExp && filterRegExp !== currentFilter) {
pfeldman 2016/03/14 23:51:34 We prefer early returns to nested conditions.
Allada-Google 2016/03/15 17:13:08 Done.
126 // If the list is not fully rendered don't try and continue
127 if (this._rootElement) {
pfeldman 2016/03/14 23:51:34 ditto
Allada-Google 2016/03/15 17:13:08 Done.
128 var textNode = this._rootElement.firstChild();
pfeldman 2016/03/14 23:51:35 textNode is not really a text node, it is a first
129 var childTextNodes = this.element.childTextNodes();
pfeldman 2016/03/14 23:51:34 unused?
130 var newExp = new RegExp(filterRegExp.source, 'gi');
pfeldman 2016/03/14 23:51:34 "gi", also, why new regex?
Allada-Google 2016/03/15 17:13:08 Done.
131
132 if (this.selectedTreeElement && !this.selectedTreeElement.select able)
133 this.selectNext() || this.selectPrevious();
134
135 do {
136 var match;
137 var ranges = [];
138 var textContent = textNode._listItemNode.textContent;
139 while ((match = newExp.exec(textContent)) !== null) {
pfeldman 2016/03/14 23:51:35 drop !== null, extract match from comparison into
Allada-Google 2016/03/15 17:13:08 Done.
140 ranges.push(new WebInspector.SourceRange(match.index, ma tch[0].length));
141 }
142 if (ranges.length > 0)
143 WebInspector.highlightRangesWithStyleClass(textNode._lis tItemNode, ranges, "tree-text-interactive-highlight", this._highlightChanges);
144
145 textNode = textNode.traverseNextTreeElement(true, null, true );
146 } while(textNode);
147 }
148 }
149 },
150
151 /**
152 * @return {?RegExp}
153 */
154 currentSelectionFilter: function ()
pfeldman 2016/03/14 23:51:34 do not expose
Allada-Google 2016/03/15 17:13:08 Done.
155 {
156 return this._currentSelectionFilter;
157 },
158
159 /**
78 * @return {?TreeElement} 160 * @return {?TreeElement}
79 */ 161 */
80 firstChild: function() 162 firstChild: function()
81 { 163 {
82 return this._rootElement.firstChild(); 164 return this._rootElement.firstChild();
83 }, 165 },
84 166
85 /** 167 /**
86 * @param {!TreeElement} child 168 * @param {!TreeElement} child
87 */ 169 */
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 { 262 {
181 if (!element.treeOutline) 263 if (!element.treeOutline)
182 console.error("Unbinding element that was not bound: " + new Error() .stack); 264 console.error("Unbinding element that was not bound: " + new Error() .stack);
183 265
184 element.deselect(); 266 element.deselect();
185 element.onunbind(); 267 element.onunbind();
186 element.treeOutline = null; 268 element.treeOutline = null;
187 }, 269 },
188 270
189 /** 271 /**
272 * @param {!TreeElement} treeElement
273 * @return {boolean}
274 */
275 checkFilter: function (treeElement)
pfeldman 2016/03/14 23:51:34 ditto
Allada-Google 2016/03/15 17:13:08 Done.
276 {
277 return this.currentSelectionFilter() ? this.currentSelectionFilter().tes t(treeElement.titleText) : true;
278 },
279
280 /**
190 * @return {boolean} 281 * @return {boolean}
191 */ 282 */
192 selectPrevious: function() 283 selectPrevious: function()
193 { 284 {
194 var nextSelectedElement = this.selectedTreeElement.traversePreviousTreeE lement(true); 285 var nextSelectedElement = this.selectedTreeElement.traversePreviousTreeE lement(true);
195 while (nextSelectedElement && !nextSelectedElement.selectable) 286 while (nextSelectedElement && !nextSelectedElement.selectable)
196 nextSelectedElement = nextSelectedElement.traversePreviousTreeElemen t(!this.expandTreeElementsWhenArrowing); 287 nextSelectedElement = nextSelectedElement.traversePreviousTreeElemen t(!this.expandTreeElementsWhenArrowing);
197 if (nextSelectedElement) { 288 if (nextSelectedElement) {
198 nextSelectedElement.reveal(); 289 nextSelectedElement.reveal();
199 nextSelectedElement.select(false, true); 290 nextSelectedElement.select(false, true);
(...skipping 14 matching lines...) Expand all
214 nextSelectedElement.reveal(); 305 nextSelectedElement.reveal();
215 nextSelectedElement.select(false, true); 306 nextSelectedElement.select(false, true);
216 return true; 307 return true;
217 } 308 }
218 return false; 309 return false;
219 }, 310 },
220 311
221 /** 312 /**
222 * @param {!Event} event 313 * @param {!Event} event
223 */ 314 */
315 _handleClick: function (event)
316 {
317 if (this._interactiveFilterEnabled)
318 this.setCurrentSelectionFilterString('');
pfeldman 2016/03/14 23:51:34 ""
Allada-Google 2016/03/15 17:13:08 Done.
319 },
320
321 /**
322 * @param {!Event} event
323 */
324 _handleBlur: function (event)
325 {
326 if (this._interactiveFilterEnabled)
327 this.setCurrentSelectionFilterString('');
328 },
329
330 /**
331 * @param {!Event} event
332 */
224 _treeKeyDown: function(event) 333 _treeKeyDown: function(event)
225 { 334 {
226 if (event.target !== this._contentElement) 335 if (event.target !== this._contentElement)
227 return; 336 return;
228 337
229 if (!this.selectedTreeElement || event.shiftKey || event.metaKey || even t.ctrlKey) 338 if (!this.selectedTreeElement || event.shiftKey || event.metaKey || even t.ctrlKey)
230 return; 339 return;
231 340
341 var currentFilterString = this.currentSelectionFilterString();
232 var handled = false; 342 var handled = false;
343 var key = event.keyCode;
233 var nextSelectedElement; 344 var nextSelectedElement;
234 if (event.keyIdentifier === "Up" && !event.altKey) { 345
235 handled = this.selectPrevious(); 346 switch (key) {
236 } else if (event.keyIdentifier === "Down" && !event.altKey) { 347 case WebInspector.KeyboardShortcut.Keys.Esc.code:
237 handled = this.selectNext(); 348 if (this._interactiveFilterEnabled) {
238 } else if (event.keyIdentifier === "Left") { 349 if (currentFilterString.length !== 0)
pfeldman 2016/03/14 23:51:35 drop !== 0
Allada-Google 2016/03/15 17:13:08 Done.
239 if (this.selectedTreeElement.expanded) { 350 // Consider the item handled if the filter string is already set (this will keep the console from triggering)
240 if (event.altKey) 351 handled = true;
241 this.selectedTreeElement.collapseRecursively(); 352 this.setCurrentSelectionFilterString('');
242 else
243 this.selectedTreeElement.collapse();
244 handled = true;
245 } else if (this.selectedTreeElement.parent && !this.selectedTreeElem ent.parent.root) {
246 handled = true;
247 if (this.selectedTreeElement.parent.selectable) {
248 nextSelectedElement = this.selectedTreeElement.parent;
249 while (nextSelectedElement && !nextSelectedElement.selectabl e)
250 nextSelectedElement = nextSelectedElement.parent;
251 handled = nextSelectedElement ? true : false;
252 } else if (this.selectedTreeElement.parent)
253 this.selectedTreeElement.parent.collapse();
254 } 353 }
255 } else if (event.keyIdentifier === "Right") { 354 break;
355 case WebInspector.KeyboardShortcut.Keys.Delete.code:
356 if (this._interactiveFilterEnabled)
357 this.setCurrentSelectionFilterString('');
358 case WebInspector.KeyboardShortcut.Keys.Backspace.code:
359 if (this._interactiveFilterEnabled === false || currentFilterString. length === 0)
360 handled = this.selectedTreeElement.ondelete();
361 else if (this._interactiveFilterEnabled)
362 this.setCurrentSelectionFilterString(currentFilterString.substr( 0, currentFilterString.length - 1));
363 break;
364 case WebInspector.KeyboardShortcut.Keys.Right.code:
pfeldman 2016/03/14 23:51:34 Group these and use case fallthrough to handle the
Allada-Google 2016/03/15 17:13:08 I optimized the code I added here as much as I fou
365 if (this._interactiveFilterEnabled)
366 this.setCurrentSelectionFilterString('');
367
256 if (!this.selectedTreeElement.revealed()) { 368 if (!this.selectedTreeElement.revealed()) {
257 this.selectedTreeElement.reveal(); 369 this.selectedTreeElement.reveal();
258 handled = true; 370 handled = true;
259 } else if (this.selectedTreeElement._expandable) { 371 } else if (this.selectedTreeElement._expandable) {
260 handled = true; 372 handled = true;
261 if (this.selectedTreeElement.expanded) { 373 if (this.selectedTreeElement.expanded) {
262 nextSelectedElement = this.selectedTreeElement.firstChild(); 374 nextSelectedElement = this.selectedTreeElement.firstChild();
263 while (nextSelectedElement && !nextSelectedElement.selectabl e) 375 while (nextSelectedElement && !nextSelectedElement.selectabl e)
264 nextSelectedElement = nextSelectedElement.nextSibling; 376 nextSelectedElement = nextSelectedElement.nextSibling;
265 handled = nextSelectedElement ? true : false; 377 handled = nextSelectedElement ? true : false;
266 } else { 378 } else {
267 if (event.altKey) 379 if (event.altKey)
268 this.selectedTreeElement.expandRecursively(); 380 this.selectedTreeElement.expandRecursively();
269 else 381 else
270 this.selectedTreeElement.expand(); 382 this.selectedTreeElement.expand();
271 } 383 }
272 } 384 }
273 } else if (event.keyCode === 8 /* Backspace */ || event.keyCode === 46 / * Delete */) 385 break;
274 handled = this.selectedTreeElement.ondelete(); 386 case WebInspector.KeyboardShortcut.Keys.Left.code:
275 else if (isEnterKey(event)) 387 if (this._interactiveFilterEnabled)
276 handled = this.selectedTreeElement.onenter(); 388 this.setCurrentSelectionFilterString('');
277 else if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Space.code ) 389
278 handled = this.selectedTreeElement.onspace(); 390 if (this.selectedTreeElement.expanded) {
391 if (event.altKey)
392 this.selectedTreeElement.collapseRecursively();
393 else
394 this.selectedTreeElement.collapse();
395 handled = true;
396 } else if (this.selectedTreeElement.parent && !this.selectedTreeElem ent.parent.root) {
397 handled = true;
398 if (this.selectedTreeElement.parent.selectable) {
399 nextSelectedElement = this.selectedTreeElement.parent;
400 while (nextSelectedElement && !nextSelectedElement.selectabl e)
401 nextSelectedElement = nextSelectedElement.parent;
402 handled = nextSelectedElement ? true : false;
403 } else if (this.selectedTreeElement.parent)
404 this.selectedTreeElement.parent.collapse();
405 }
406 break;
407 case WebInspector.KeyboardShortcut.Keys.Down.code:
408 if (!event.altKey)
409 handled = this.selectNext();
410 break;
411 case WebInspector.KeyboardShortcut.Keys.Up.code:
412 if (!event.altKey)
413 handled = this.selectPrevious();
414 break;
415 case WebInspector.KeyboardShortcut.Keys.Space.code:
416 // Do not send space key event if the search filter has stuff in buf fer
417 if (currentFilterString.length === 0)
418 handled = this.selectedTreeElement.onspace();
419 break;
420 default:
421 if (isEnterKey(event)) {
422 if (this._interactiveFilterEnabled)
423 this.setCurrentSelectionFilterString('');
424
425 handled = this.selectedTreeElement.onenter();
426 }
427 }
279 428
280 if (nextSelectedElement) { 429 if (nextSelectedElement) {
281 nextSelectedElement.reveal(); 430 nextSelectedElement.reveal();
282 nextSelectedElement.select(false, true); 431 nextSelectedElement.select(false, true);
283 } 432 }
284 433
285 if (handled) 434 if (handled)
286 event.consume(true); 435 event.consume(true);
287 }, 436 },
288 437
289 /** 438 /**
439 * @param {!Event} event
440 */
441 _treeKeyPress: function (event)
442 {
443 if (this._interactiveFilterEnabled === false)
pfeldman 2016/03/14 23:51:34 !this._interactiveFilterEnabled
Allada-Google 2016/03/15 17:13:08 Done.
444 return;
445
446 if (event.target !== this._contentElement)
447 return;
448
449 if (!this.selectedTreeElement || event.shiftKey || event.metaKey || even t.ctrlKey)
450 return;
451
452 var currentFilterString = this.currentSelectionFilterString();
453
454 switch (event.data) {
455 case "\r":
456 case "\n":
457 break;
458 case " ":
459 if (currentFilterString.length === 0) {
460 break;
461 }
462 default:
463 this.setCurrentSelectionFilterString(currentFilterString + event.dat a);
464 }
465 },
466
467 /**
290 * @param {!TreeElement} treeElement 468 * @param {!TreeElement} treeElement
291 * @param {boolean} center 469 * @param {boolean} center
292 */ 470 */
293 _deferredScrollIntoView: function(treeElement, center) 471 _deferredScrollIntoView: function(treeElement, center)
294 { 472 {
295 if (!this._treeElementToScrollIntoView) 473 if (!this._treeElementToScrollIntoView)
296 this.element.window().requestAnimationFrame(deferredScrollIntoView.b ind(this)); 474 this.element.window().requestAnimationFrame(deferredScrollIntoView.b ind(this));
297 this._treeElementToScrollIntoView = treeElement; 475 this._treeElementToScrollIntoView = treeElement;
298 this._centerUponScrollIntoView = center; 476 this._centerUponScrollIntoView = center;
299 /** 477 /**
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 function TreeElement(title, expandable) 531 function TreeElement(title, expandable)
354 { 532 {
355 /** @type {?TreeOutline} */ 533 /** @type {?TreeOutline} */
356 this.treeOutline = null; 534 this.treeOutline = null;
357 this.parent = null; 535 this.parent = null;
358 this.previousSibling = null; 536 this.previousSibling = null;
359 this.nextSibling = null; 537 this.nextSibling = null;
360 538
361 this._listItemNode = createElement("li"); 539 this._listItemNode = createElement("li");
362 this._listItemNode.treeElement = this; 540 this._listItemNode.treeElement = this;
541 this.titleText = null;
pfeldman 2016/03/14 23:51:34 Lets compute this dynamically off element's text c
363 if (title) 542 if (title)
364 this.title = title; 543 this.title = title;
365 this._listItemNode.addEventListener("mousedown", this._handleMouseDown.bind( this), false); 544 this._listItemNode.addEventListener("mousedown", this._handleMouseDown.bind( this), false);
366 this._listItemNode.addEventListener("selectstart", this._treeElementSelectSt art.bind(this), false); 545 this._listItemNode.addEventListener("selectstart", this._treeElementSelectSt art.bind(this), false);
367 this._listItemNode.addEventListener("click", this._treeElementToggled.bind(t his), false); 546 this._listItemNode.addEventListener("click", this._treeElementToggled.bind(t his), false);
368 this._listItemNode.addEventListener("dblclick", this._handleDoubleClick.bind (this), false); 547 this._listItemNode.addEventListener("dblclick", this._handleDoubleClick.bind (this), false);
369 548
370 this._childrenListNode = createElement("ol"); 549 this._childrenListNode = createElement("ol");
371 this._childrenListNode.parentTreeElement = this; 550 this._childrenListNode.parentTreeElement = this;
372 this._childrenListNode.classList.add("children"); 551 this._childrenListNode.classList.add("children");
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 this.treeOutline._unbindTreeElement(child); 775 this.treeOutline._unbindTreeElement(child);
597 for (var current = child.firstChild(); this.treeOutline && current; current = current.traverseNextTreeElement(false, child, true)) 776 for (var current = child.firstChild(); this.treeOutline && current; current = current.traverseNextTreeElement(false, child, true))
598 this.treeOutline._unbindTreeElement(current); 777 this.treeOutline._unbindTreeElement(current);
599 child._detach(); 778 child._detach();
600 } 779 }
601 this._children = []; 780 this._children = [];
602 }, 781 },
603 782
604 get selectable() 783 get selectable()
605 { 784 {
606 if (this._hidden) 785 if (this._hidden || !this.treeOutline.checkFilter(this))
607 return false; 786 return false;
608 return this._selectable; 787 return this._selectable;
609 }, 788 },
610 789
611 set selectable(x) 790 set selectable(x)
612 { 791 {
613 this._selectable = x; 792 this._selectable = x;
614 }, 793 },
615 794
616 get listItemElement() 795 get listItemElement()
(...skipping 17 matching lines...) Expand all
634 set title(x) 813 set title(x)
635 { 814 {
636 if (this._title === x) 815 if (this._title === x)
637 return; 816 return;
638 this._title = x; 817 this._title = x;
639 818
640 if (typeof x === "string") { 819 if (typeof x === "string") {
641 this._titleElement = createElementWithClass("span", "tree-element-ti tle"); 820 this._titleElement = createElementWithClass("span", "tree-element-ti tle");
642 this._titleElement.textContent = x; 821 this._titleElement.textContent = x;
643 this.tooltip = x; 822 this.tooltip = x;
823 this.titleText = x;
644 } else { 824 } else {
645 this._titleElement = x; 825 this._titleElement = x;
646 this.tooltip = ""; 826 this.tooltip = "";
647 } 827 }
648 828
649 this._listItemNode.removeChildren(); 829 this._listItemNode.removeChildren();
650 if (this._iconElement) 830 if (this._iconElement)
651 this._listItemNode.appendChild(this._iconElement); 831 this._listItemNode.appendChild(this._iconElement);
652 832
653 this._listItemNode.appendChild(this._titleElement); 833 this._listItemNode.appendChild(this._titleElement);
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 isEventWithinDisclosureTriangle: function(event) 1332 isEventWithinDisclosureTriangle: function(event)
1153 { 1333 {
1154 // FIXME: We should not use getComputedStyle(). For that we need to get rid of using ::before for disclosure triangle. (http://webk.it/74446) 1334 // FIXME: We should not use getComputedStyle(). For that we need to get rid of using ::before for disclosure triangle. (http://webk.it/74446)
1155 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddi ngLeft; 1335 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddi ngLeft;
1156 console.assert(paddingLeftValue.endsWith("px")); 1336 console.assert(paddingLeftValue.endsWith("px"));
1157 var computedLeftPadding = parseFloat(paddingLeftValue); 1337 var computedLeftPadding = parseFloat(paddingLeftValue);
1158 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; 1338 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding;
1159 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo ggleWidth && this._expandable; 1339 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo ggleWidth && this._expandable;
1160 } 1340 }
1161 } 1341 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698