OLD | NEW |
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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 { | 338 { |
339 if (!this.searchable || WebInspector.isBeingEdited(this._childrenListNode)) | 339 if (!this.searchable || WebInspector.isBeingEdited(this._childrenListNode)) |
340 return; | 340 return; |
341 | 341 |
342 var searchText = String.fromCharCode(event.charCode); | 342 var searchText = String.fromCharCode(event.charCode); |
343 // Ignore whitespace. | 343 // Ignore whitespace. |
344 if (searchText.trim() !== searchText) | 344 if (searchText.trim() !== searchText) |
345 return; | 345 return; |
346 | 346 |
347 this._startSearch(searchText); | 347 this._startSearch(searchText); |
348 event.consume(); | 348 event.consume(true); |
349 } | 349 } |
350 | 350 |
351 TreeOutline.prototype._treeKeyDown = function(event) | 351 TreeOutline.prototype._treeKeyDown = function(event) |
352 { | 352 { |
353 if (event.target !== this._childrenListNode) | 353 if (event.target !== this._childrenListNode) |
354 return; | 354 return; |
355 | 355 |
356 if (!this.selectedTreeElement || event.shiftKey || event.metaKey || event.ct
rlKey) | 356 if (!this.selectedTreeElement || event.shiftKey || event.metaKey || event.ct
rlKey) |
357 return; | 357 return; |
358 | 358 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 if (this.selectedTreeElement.onspace) | 413 if (this.selectedTreeElement.onspace) |
414 handled = this.selectedTreeElement.onspace(); | 414 handled = this.selectedTreeElement.onspace(); |
415 } | 415 } |
416 | 416 |
417 if (nextSelectedElement) { | 417 if (nextSelectedElement) { |
418 nextSelectedElement.reveal(); | 418 nextSelectedElement.reveal(); |
419 nextSelectedElement.select(false, true); | 419 nextSelectedElement.select(false, true); |
420 } | 420 } |
421 | 421 |
422 if (handled) | 422 if (handled) |
423 event.consume(); | 423 event.consume(true); |
424 } | 424 } |
425 | 425 |
426 TreeOutline.prototype.expand = function() | 426 TreeOutline.prototype.expand = function() |
427 { | 427 { |
428 // this is the root, do nothing | 428 // this is the root, do nothing |
429 } | 429 } |
430 | 430 |
431 TreeOutline.prototype.collapse = function() | 431 TreeOutline.prototype.collapse = function() |
432 { | 432 { |
433 // this is the root, do nothing | 433 // this is the root, do nothing |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 this._searchFinished(); | 534 this._searchFinished(); |
535 if (lastSearchMatchElement && lastSearchMatchElement.onenter) | 535 if (lastSearchMatchElement && lastSearchMatchElement.onenter) |
536 lastSearchMatchElement.onenter(); | 536 lastSearchMatchElement.onenter(); |
537 handled = true; | 537 handled = true; |
538 } | 538 } |
539 | 539 |
540 if (nextSelectedElement) | 540 if (nextSelectedElement) |
541 this._showSearchMatchElement(nextSelectedElement); | 541 this._showSearchMatchElement(nextSelectedElement); |
542 | 542 |
543 if (handled) | 543 if (handled) |
544 event.consume(); | 544 event.consume(true); |
545 else | 545 else |
546 window.setTimeout(this._boundSearchTextChanged, 0); | 546 window.setTimeout(this._boundSearchTextChanged, 0); |
547 } | 547 } |
548 | 548 |
549 /** | 549 /** |
550 * @param {string} searchText | 550 * @param {string} searchText |
551 * @param {TreeElement} startTreeElement | 551 * @param {TreeElement} startTreeElement |
552 * @param {boolean} skipStartTreeElement | 552 * @param {boolean} skipStartTreeElement |
553 */ | 553 */ |
554 TreeOutline.prototype._nextSearchMatch = function(searchText, startTreeElement,
skipStartTreeElement) | 554 TreeOutline.prototype._nextSearchMatch = function(searchText, startTreeElement,
skipStartTreeElement) |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 return false; | 1002 return false; |
1003 currentAncestor = currentAncestor.parent; | 1003 currentAncestor = currentAncestor.parent; |
1004 } | 1004 } |
1005 | 1005 |
1006 return true; | 1006 return true; |
1007 } | 1007 } |
1008 | 1008 |
1009 TreeElement.prototype.selectOnMouseDown = function(event) | 1009 TreeElement.prototype.selectOnMouseDown = function(event) |
1010 { | 1010 { |
1011 if (this.select(false, true)) | 1011 if (this.select(false, true)) |
1012 event.consume(); | 1012 event.consume(true); |
1013 } | 1013 } |
1014 | 1014 |
1015 /** | 1015 /** |
1016 * @param {boolean=} omitFocus | 1016 * @param {boolean=} omitFocus |
1017 * @param {boolean=} selectedByUser | 1017 * @param {boolean=} selectedByUser |
1018 * @return {boolean} | 1018 * @return {boolean} |
1019 */ | 1019 */ |
1020 TreeElement.prototype.select = function(omitFocus, selectedByUser) | 1020 TreeElement.prototype.select = function(omitFocus, selectedByUser) |
1021 { | 1021 { |
1022 if (!this.treeOutline || !this.selectable || this.selected) | 1022 if (!this.treeOutline || !this.selectable || this.selected) |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 return this.parent; | 1142 return this.parent; |
1143 } | 1143 } |
1144 | 1144 |
1145 TreeElement.prototype.isEventWithinDisclosureTriangle = function(event) | 1145 TreeElement.prototype.isEventWithinDisclosureTriangle = function(event) |
1146 { | 1146 { |
1147 // FIXME: We should not use getComputedStyle(). For that we need to get rid
of using ::before for disclosure triangle. (http://webk.it/74446) | 1147 // FIXME: We should not use getComputedStyle(). For that we need to get rid
of using ::before for disclosure triangle. (http://webk.it/74446) |
1148 var computedLeftPadding = window.getComputedStyle(this._listItemNode).getPro
pertyCSSValue("padding-left").getFloatValue(CSSPrimitiveValue.CSS_PX); | 1148 var computedLeftPadding = window.getComputedStyle(this._listItemNode).getPro
pertyCSSValue("padding-left").getFloatValue(CSSPrimitiveValue.CSS_PX); |
1149 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; | 1149 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; |
1150 return event.pageX >= left && event.pageX <= left + this.arrowToggleWidth &&
this.hasChildren; | 1150 return event.pageX >= left && event.pageX <= left + this.arrowToggleWidth &&
this.hasChildren; |
1151 } | 1151 } |
OLD | NEW |