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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 /** @type {?TreeOutline} */ | 305 /** @type {?TreeOutline} */ |
306 this.treeOutline = null; | 306 this.treeOutline = null; |
307 this.parent = null; | 307 this.parent = null; |
308 this.previousSibling = null; | 308 this.previousSibling = null; |
309 this.nextSibling = null; | 309 this.nextSibling = null; |
310 | 310 |
311 this._listItemNode = createElement("li"); | 311 this._listItemNode = createElement("li"); |
312 this._listItemNode.treeElement = this; | 312 this._listItemNode.treeElement = this; |
313 if (title) | 313 if (title) |
314 this.title = title; | 314 this.title = title; |
315 if (typeof title === "string") | |
316 this.tooltip = title; | |
317 this._listItemNode.addEventListener("mousedown", this._handleMouseDown.bind(
this), false); | 315 this._listItemNode.addEventListener("mousedown", this._handleMouseDown.bind(
this), false); |
318 this._listItemNode.addEventListener("selectstart", this._treeElementSelectSt
art.bind(this), false); | 316 this._listItemNode.addEventListener("selectstart", this._treeElementSelectSt
art.bind(this), false); |
319 this._listItemNode.addEventListener("click", this._treeElementToggled.bind(t
his), false); | 317 this._listItemNode.addEventListener("click", this._treeElementToggled.bind(t
his), false); |
320 this._listItemNode.addEventListener("dblclick", this._handleDoubleClick.bind
(this), false); | 318 this._listItemNode.addEventListener("dblclick", this._handleDoubleClick.bind
(this), false); |
321 | 319 |
322 this._childrenListNode = createElement("ol"); | 320 this._childrenListNode = createElement("ol"); |
323 this._childrenListNode.parentTreeElement = this; | 321 this._childrenListNode.parentTreeElement = this; |
324 this._childrenListNode.classList.add("children"); | 322 this._childrenListNode.classList.add("children"); |
325 | 323 |
326 this._hidden = false; | 324 this._hidden = false; |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 isEventWithinDisclosureTriangle: function(event) | 1053 isEventWithinDisclosureTriangle: function(event) |
1056 { | 1054 { |
1057 // FIXME: We should not use getComputedStyle(). For that we need to get
rid of using ::before for disclosure triangle. (http://webk.it/74446) | 1055 // FIXME: We should not use getComputedStyle(). For that we need to get
rid of using ::before for disclosure triangle. (http://webk.it/74446) |
1058 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddi
ngLeft; | 1056 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddi
ngLeft; |
1059 console.assert(paddingLeftValue.endsWith("px")); | 1057 console.assert(paddingLeftValue.endsWith("px")); |
1060 var computedLeftPadding = parseFloat(paddingLeftValue); | 1058 var computedLeftPadding = parseFloat(paddingLeftValue); |
1061 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; | 1059 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; |
1062 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo
ggleWidth && this._expandable; | 1060 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo
ggleWidth && this._expandable; |
1063 } | 1061 } |
1064 } | 1062 } |
OLD | NEW |