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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 /** @type {?TreeOutline} */ | 331 /** @type {?TreeOutline} */ |
332 this.treeOutline = null; | 332 this.treeOutline = null; |
333 this.parent = null; | 333 this.parent = null; |
334 this.previousSibling = null; | 334 this.previousSibling = null; |
335 this.nextSibling = null; | 335 this.nextSibling = null; |
336 | 336 |
337 this._listItemNode = createElement("li"); | 337 this._listItemNode = createElement("li"); |
338 this._listItemNode.treeElement = this; | 338 this._listItemNode.treeElement = this; |
339 if (title) | 339 if (title) |
340 this.title = title; | 340 this.title = title; |
341 if (typeof title === "string") | |
342 this.tooltip = title; | |
343 this._listItemNode.addEventListener("mousedown", this._handleMouseDown.bind(
this), false); | 341 this._listItemNode.addEventListener("mousedown", this._handleMouseDown.bind(
this), false); |
344 this._listItemNode.addEventListener("selectstart", this._treeElementSelectSt
art.bind(this), false); | 342 this._listItemNode.addEventListener("selectstart", this._treeElementSelectSt
art.bind(this), false); |
345 this._listItemNode.addEventListener("click", this._treeElementToggled.bind(t
his), false); | 343 this._listItemNode.addEventListener("click", this._treeElementToggled.bind(t
his), false); |
346 this._listItemNode.addEventListener("dblclick", this._handleDoubleClick.bind
(this), false); | 344 this._listItemNode.addEventListener("dblclick", this._handleDoubleClick.bind
(this), false); |
347 | 345 |
348 this._childrenListNode = createElement("ol"); | 346 this._childrenListNode = createElement("ol"); |
349 this._childrenListNode.parentTreeElement = this; | 347 this._childrenListNode.parentTreeElement = this; |
350 this._childrenListNode.classList.add("children"); | 348 this._childrenListNode.classList.add("children"); |
351 | 349 |
352 this._hidden = false; | 350 this._hidden = false; |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 isEventWithinDisclosureTriangle: function(event) | 1092 isEventWithinDisclosureTriangle: function(event) |
1095 { | 1093 { |
1096 // FIXME: We should not use getComputedStyle(). For that we need to get
rid of using ::before for disclosure triangle. (http://webk.it/74446) | 1094 // FIXME: We should not use getComputedStyle(). For that we need to get
rid of using ::before for disclosure triangle. (http://webk.it/74446) |
1097 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddi
ngLeft; | 1095 var paddingLeftValue = window.getComputedStyle(this._listItemNode).paddi
ngLeft; |
1098 console.assert(paddingLeftValue.endsWith("px")); | 1096 console.assert(paddingLeftValue.endsWith("px")); |
1099 var computedLeftPadding = parseFloat(paddingLeftValue); | 1097 var computedLeftPadding = parseFloat(paddingLeftValue); |
1100 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; | 1098 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; |
1101 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo
ggleWidth && this._expandable; | 1099 return event.pageX >= left && event.pageX <= left + TreeElement._ArrowTo
ggleWidth && this._expandable; |
1102 } | 1100 } |
1103 } | 1101 } |
OLD | NEW |