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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 return this.getCachedTreeElement(representedObject); | 316 return this.getCachedTreeElement(representedObject); |
317 } | 317 } |
318 | 318 |
319 /** | 319 /** |
320 * @param {number} x | 320 * @param {number} x |
321 * @param {number} y | 321 * @param {number} y |
322 * @return {?TreeElement} | 322 * @return {?TreeElement} |
323 */ | 323 */ |
324 TreeOutline.prototype.treeElementFromPoint = function(x, y) | 324 TreeOutline.prototype.treeElementFromPoint = function(x, y) |
325 { | 325 { |
326 var node = this._childrenListNode.ownerDocument.elementFromPoint(x, y); | 326 var node = this._childrenListNode.ownerDocument.deepElementFromPoint(x, y); |
327 if (!node) | 327 if (!node) |
328 return null; | 328 return null; |
329 | 329 |
330 var listNode = node.enclosingNodeOrSelfWithNodeNameInArray(["ol", "li"]); | 330 var listNode = node.enclosingNodeOrSelfWithNodeNameInArray(["ol", "li"]); |
331 if (listNode) | 331 if (listNode) |
332 return listNode.parentTreeElement || listNode.treeElement; | 332 return listNode.parentTreeElement || listNode.treeElement; |
333 return null; | 333 return null; |
334 } | 334 } |
335 | 335 |
| 336 /** |
| 337 * @param {?Event} event |
| 338 * @return {?TreeElement} |
| 339 */ |
| 340 TreeOutline.prototype.treeElementFromEvent = function(event) |
| 341 { |
| 342 return event ? this.treeElementFromPoint(event.pageX, event.pageY) : null; |
| 343 } |
| 344 |
336 TreeOutline.prototype._treeKeyDown = function(event) | 345 TreeOutline.prototype._treeKeyDown = function(event) |
337 { | 346 { |
338 if (event.target !== this._childrenListNode) | 347 if (event.target !== this._childrenListNode) |
339 return; | 348 return; |
340 | 349 |
341 if (!this.selectedTreeElement || event.shiftKey || event.metaKey || event.ct
rlKey) | 350 if (!this.selectedTreeElement || event.shiftKey || event.metaKey || event.ct
rlKey) |
342 return; | 351 return; |
343 | 352 |
344 var handled = false; | 353 var handled = false; |
345 var nextSelectedElement; | 354 var nextSelectedElement; |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 * @return {boolean} | 1015 * @return {boolean} |
1007 */ | 1016 */ |
1008 TreeElement.prototype.isEventWithinDisclosureTriangle = function(event) | 1017 TreeElement.prototype.isEventWithinDisclosureTriangle = function(event) |
1009 { | 1018 { |
1010 // FIXME: We should not use getComputedStyle(). For that we need to get rid
of using ::before for disclosure triangle. (http://webk.it/74446) | 1019 // FIXME: We should not use getComputedStyle(). For that we need to get rid
of using ::before for disclosure triangle. (http://webk.it/74446) |
1011 var paddingLeftValue = window.getComputedStyle(this._listItemNode).getProper
tyCSSValue("padding-left"); | 1020 var paddingLeftValue = window.getComputedStyle(this._listItemNode).getProper
tyCSSValue("padding-left"); |
1012 var computedLeftPadding = paddingLeftValue ? paddingLeftValue.getFloatValue(
CSSPrimitiveValue.CSS_PX) : 0; | 1021 var computedLeftPadding = paddingLeftValue ? paddingLeftValue.getFloatValue(
CSSPrimitiveValue.CSS_PX) : 0; |
1013 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; | 1022 var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; |
1014 return event.pageX >= left && event.pageX <= left + this.arrowToggleWidth &&
this.hasChildren; | 1023 return event.pageX >= left && event.pageX <= left + this.arrowToggleWidth &&
this.hasChildren; |
1015 } | 1024 } |
OLD | NEW |