Chromium Code Reviews| 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 357 this.previousSibling = null; | 357 this.previousSibling = null; |
| 358 this.nextSibling = null; | 358 this.nextSibling = null; |
| 359 | 359 |
| 360 this._listItemNode = createElement("li"); | 360 this._listItemNode = createElement("li"); |
| 361 this._listItemNode.treeElement = this; | 361 this._listItemNode.treeElement = this; |
| 362 if (title) | 362 if (title) |
| 363 this.title = title; | 363 this.title = title; |
| 364 this._listItemNode.addEventListener("mousedown", this._handleMouseDown.bind( this), false); | 364 this._listItemNode.addEventListener("mousedown", this._handleMouseDown.bind( this), false); |
| 365 this._listItemNode.addEventListener("selectstart", this._treeElementSelectSt art.bind(this), false); | 365 this._listItemNode.addEventListener("selectstart", this._treeElementSelectSt art.bind(this), false); |
| 366 this._listItemNode.addEventListener("click", this._treeElementToggled.bind(t his), false); | 366 this._listItemNode.addEventListener("click", this._treeElementToggled.bind(t his), false); |
| 367 this._listItemNode.addEventListener("dblclick", this._handleDoubleClick.bind (this), false); | 367 this._listItemNode.addEventListener("auxclick", this._treeElementToggled.bin d(this), false); |
|
dgozman
2016/08/03 20:54:28
Why change this? Are you going to stop sending dbl
Navid Zolghadr
2016/08/03 21:35:20
We stopped sending dblclick for middle button but
dgozman
2016/08/03 22:31:49
I cannot repro the behavior you mention on linux.
Navid Zolghadr
2016/08/04 14:42:05
Sure. done.
| |
| 368 | 368 |
| 369 this._childrenListNode = createElement("ol"); | 369 this._childrenListNode = createElement("ol"); |
| 370 this._childrenListNode.parentTreeElement = this; | 370 this._childrenListNode.parentTreeElement = this; |
| 371 this._childrenListNode.classList.add("children"); | 371 this._childrenListNode.classList.add("children"); |
| 372 | 372 |
| 373 this._hidden = false; | 373 this._hidden = false; |
| 374 this._selectable = true; | 374 this._selectable = true; |
| 375 this.expanded = false; | 375 this.expanded = false; |
| 376 this.selected = false; | 376 this.selected = false; |
| 377 this.setExpandable(expandable || false); | 377 this.setExpandable(expandable || false); |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 777 { | 777 { |
| 778 event.currentTarget._selectionStarted = true; | 778 event.currentTarget._selectionStarted = true; |
| 779 }, | 779 }, |
| 780 | 780 |
| 781 /** | 781 /** |
| 782 * @param {!Event} event | 782 * @param {!Event} event |
| 783 */ | 783 */ |
| 784 _treeElementToggled: function(event) | 784 _treeElementToggled: function(event) |
| 785 { | 785 { |
| 786 var element = event.currentTarget; | 786 var element = event.currentTarget; |
| 787 | |
| 788 // Handling dblclick | |
| 789 if (event.detail === 2) { | |
| 790 if (!element || element.treeElement !== this) | |
| 791 return; | |
| 792 | |
| 793 var handled = this.ondblclick(event); | |
| 794 if (handled) | |
| 795 return; | |
| 796 if (this._expandable && !this.expanded) | |
| 797 this.expand(); | |
| 798 return; | |
| 799 } | |
| 800 | |
| 787 if (element._selectionStarted) { | 801 if (element._selectionStarted) { |
| 788 delete element._selectionStarted; | 802 delete element._selectionStarted; |
| 789 var selection = element.getComponentSelection(); | 803 var selection = element.getComponentSelection(); |
| 790 if (selection && !selection.isCollapsed && element.isSelfOrAncestor( selection.anchorNode) && element.isSelfOrAncestor(selection.focusNode)) | 804 if (selection && !selection.isCollapsed && element.isSelfOrAncestor( selection.anchorNode) && element.isSelfOrAncestor(selection.focusNode)) |
| 791 return; | 805 return; |
| 792 } | 806 } |
| 793 | 807 |
| 794 if (element.treeElement !== this) | 808 if (element.treeElement !== this) |
| 795 return; | 809 return; |
| 796 | 810 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 830 return; | 844 return; |
| 831 if (element.treeElement !== this) | 845 if (element.treeElement !== this) |
| 832 return; | 846 return; |
| 833 | 847 |
| 834 if (this.isEventWithinDisclosureTriangle(event)) | 848 if (this.isEventWithinDisclosureTriangle(event)) |
| 835 return; | 849 return; |
| 836 | 850 |
| 837 this.selectOnMouseDown(event); | 851 this.selectOnMouseDown(event); |
| 838 }, | 852 }, |
| 839 | 853 |
| 840 /** | |
| 841 * @param {!Event} event | |
| 842 */ | |
| 843 _handleDoubleClick: function(event) | |
| 844 { | |
| 845 var element = event.currentTarget; | |
| 846 if (!element || element.treeElement !== this) | |
| 847 return; | |
| 848 | |
| 849 var handled = this.ondblclick(event); | |
| 850 if (handled) | |
| 851 return; | |
| 852 if (this._expandable && !this.expanded) | |
| 853 this.expand(); | |
| 854 }, | |
| 855 | |
| 856 _detach: function() | 854 _detach: function() |
| 857 { | 855 { |
| 858 this._listItemNode.remove(); | 856 this._listItemNode.remove(); |
| 859 this._childrenListNode.remove(); | 857 this._childrenListNode.remove(); |
| 860 }, | 858 }, |
| 861 | 859 |
| 862 collapse: function() | 860 collapse: function() |
| 863 { | 861 { |
| 864 if (!this.expanded || !this._collapsible) | 862 if (!this.expanded || !this._collapsible) |
| 865 return; | 863 return; |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1163 isEventWithinDisclosureTriangle: function(event) | 1161 isEventWithinDisclosureTriangle: function(event) |
| 1164 { | 1162 { |
| 1165 // FIXME: We should not use getComputedStyle(). For that we need to get rid of using ::before for disclosure triangle. (http://webk.it/74446) | 1163 // 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; | 1164 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddi ngLeft; |
| 1167 console.assert(paddingLeftValue.endsWith("px")); | 1165 console.assert(paddingLeftValue.endsWith("px")); |
| 1168 var computedLeftPadding = parseFloat(paddingLeftValue); | 1166 var computedLeftPadding = parseFloat(paddingLeftValue); |
| 1169 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; | 1167 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; |
| 1170 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo ggleWidth && this._expandable; | 1168 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo ggleWidth && this._expandable; |
| 1171 } | 1169 } |
| 1172 } | 1170 } |
| OLD | NEW |