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 30 matching lines...) Expand all Loading... |
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 | 45 |
46 this.setFocusable(!nonFocusable); | 46 this.setFocusable(!nonFocusable); |
47 | 47 |
48 this.element = this.contentElement; | 48 this.element = this.contentElement; |
49 } | 49 } |
50 | 50 |
| 51 /** @enum {symbol} */ |
51 TreeOutline.Events = { | 52 TreeOutline.Events = { |
52 ElementAttached: "ElementAttached", | 53 ElementAttached: Symbol("ElementAttached"), |
53 ElementExpanded: "ElementExpanded", | 54 ElementExpanded: Symbol("ElementExpanded"), |
54 ElementCollapsed: "ElementCollapsed", | 55 ElementCollapsed: Symbol("ElementCollapsed"), |
55 ElementSelected: "ElementSelected" | 56 ElementSelected: Symbol("ElementSelected") |
56 } | 57 } |
57 | 58 |
58 TreeOutline.prototype = { | 59 TreeOutline.prototype = { |
59 _createRootElement: function() | 60 _createRootElement: function() |
60 { | 61 { |
61 this._rootElement = new TreeElement(); | 62 this._rootElement = new TreeElement(); |
62 this._rootElement.treeOutline = this; | 63 this._rootElement.treeOutline = this; |
63 this._rootElement.root = true; | 64 this._rootElement.root = true; |
64 this._rootElement.selectable = false; | 65 this._rootElement.selectable = false; |
65 this._rootElement.expanded = true; | 66 this._rootElement.expanded = true; |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 isEventWithinDisclosureTriangle: function(event) | 1164 isEventWithinDisclosureTriangle: function(event) |
1164 { | 1165 { |
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 // 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; | 1167 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddi
ngLeft; |
1167 console.assert(paddingLeftValue.endsWith("px")); | 1168 console.assert(paddingLeftValue.endsWith("px")); |
1168 var computedLeftPadding = parseFloat(paddingLeftValue); | 1169 var computedLeftPadding = parseFloat(paddingLeftValue); |
1169 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; | 1170 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; |
1170 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo
ggleWidth && this._expandable; | 1171 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo
ggleWidth && this._expandable; |
1171 } | 1172 } |
1172 } | 1173 } |
OLD | NEW |