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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 element._selectionStarted = true; | 672 element._selectionStarted = true; |
673 } | 673 } |
674 | 674 |
675 TreeElement.treeElementToggled = function(event) | 675 TreeElement.treeElementToggled = function(event) |
676 { | 676 { |
677 var element = event.currentTarget; | 677 var element = event.currentTarget; |
678 if (!element) | 678 if (!element) |
679 return; | 679 return; |
680 if (element._selectionStarted) { | 680 if (element._selectionStarted) { |
681 delete element._selectionStarted | 681 delete element._selectionStarted |
682 var selection = window.getSelection(); | 682 var selection = element.window().getSelection(); |
683 if (selection && !selection.isCollapsed && element.isSelfOrAncestor(sele
ction.anchorNode) && element.isSelfOrAncestor(selection.focusNode)) | 683 if (selection && !selection.isCollapsed && element.isSelfOrAncestor(sele
ction.anchorNode) && element.isSelfOrAncestor(selection.focusNode)) |
684 return; | 684 return; |
685 } | 685 } |
686 | 686 |
687 if (!element.treeElement) | 687 if (!element.treeElement) |
688 return; | 688 return; |
689 | 689 |
690 var toggleOnClick = element.treeElement.toggleOnClick && !element.treeElemen
t.selectable; | 690 var toggleOnClick = element.treeElement.toggleOnClick && !element.treeElemen
t.selectable; |
691 var isInTriangle = element.treeElement.isEventWithinDisclosureTriangle(event
); | 691 var isInTriangle = element.treeElement.isEventWithinDisclosureTriangle(event
); |
692 if (!toggleOnClick && !isInTriangle) | 692 if (!toggleOnClick && !isInTriangle) |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 */ | 1028 */ |
1029 TreeElement.prototype.isEventWithinDisclosureTriangle = function(event) | 1029 TreeElement.prototype.isEventWithinDisclosureTriangle = function(event) |
1030 { | 1030 { |
1031 // FIXME: We should not use getComputedStyle(). For that we need to get rid
of using ::before for disclosure triangle. (http://webk.it/74446) | 1031 // FIXME: We should not use getComputedStyle(). For that we need to get rid
of using ::before for disclosure triangle. (http://webk.it/74446) |
1032 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddingLe
ft; | 1032 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddingLe
ft; |
1033 console.assert(paddingLeftValue.endsWith("px")); | 1033 console.assert(paddingLeftValue.endsWith("px")); |
1034 var computedLeftPadding = parseFloat(paddingLeftValue); | 1034 var computedLeftPadding = parseFloat(paddingLeftValue); |
1035 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; | 1035 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; |
1036 return event.pageX >= left && event.pageX <= left + this.arrowToggleWidth &&
this.hasChildren; | 1036 return event.pageX >= left && event.pageX <= left + this.arrowToggleWidth &&
this.hasChildren; |
1037 } | 1037 } |
OLD | NEW |