OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 if (!node) | 607 if (!node) |
608 return; | 608 return; |
609 var treeElement = this.createTreeElementFor(node); | 609 var treeElement = this.createTreeElementFor(node); |
610 if (!treeElement) | 610 if (!treeElement) |
611 return; | 611 return; |
612 | 612 |
613 treeElement.revealAndSelect(omitFocus); | 613 treeElement.revealAndSelect(omitFocus); |
614 }, | 614 }, |
615 | 615 |
616 /** | 616 /** |
| 617 * @param {?WebInspector.DOMNode} node |
| 618 */ |
| 619 highlightNode: function(node) |
| 620 { |
| 621 var treeElement = null; |
| 622 if (node) { |
| 623 treeElement = this.createTreeElementFor(node); |
| 624 treeElement.reveal(); |
| 625 } |
| 626 this._setHoverEffect(treeElement); |
| 627 }, |
| 628 |
| 629 /** |
617 * @return {?TreeElement} | 630 * @return {?TreeElement} |
618 */ | 631 */ |
619 _treeElementFromEvent: function(event) | 632 _treeElementFromEvent: function(event) |
620 { | 633 { |
621 var scrollContainer = this.element.parentElement; | 634 var scrollContainer = this.element.parentElement; |
622 | 635 |
623 // We choose this X coordinate based on the knowledge that our list | 636 // We choose this X coordinate based on the knowledge that our list |
624 // items extend at least to the right edge of the outer <ol> container. | 637 // items extend at least to the right edge of the outer <ol> container. |
625 // In the no-word-wrap mode the outer <ol> may be wider than the tree co
ntainer | 638 // In the no-word-wrap mode the outer <ol> may be wider than the tree co
ntainer |
626 // (and partially hidden), in which case we are left to use only its rig
ht boundary. | 639 // (and partially hidden), in which case we are left to use only its rig
ht boundary. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 _onmousedown: function(event) | 729 _onmousedown: function(event) |
717 { | 730 { |
718 var element = this._treeElementFromEvent(event); | 731 var element = this._treeElementFromEvent(event); |
719 | 732 |
720 if (!element || element.isEventWithinDisclosureTriangle(event)) | 733 if (!element || element.isEventWithinDisclosureTriangle(event)) |
721 return; | 734 return; |
722 | 735 |
723 element.select(); | 736 element.select(); |
724 }, | 737 }, |
725 | 738 |
726 _onmousemove: function(event) | 739 /** |
| 740 * @param {?TreeElement} treeElement |
| 741 */ |
| 742 _setHoverEffect: function (treeElement) |
727 { | 743 { |
728 var element = this._treeElementFromEvent(event); | 744 if (this._previousHoveredElement === treeElement) |
729 if (element && this._previousHoveredElement === element) | |
730 return; | 745 return; |
731 | 746 |
732 if (this._previousHoveredElement) { | 747 if (this._previousHoveredElement) { |
733 this._previousHoveredElement.hovered = false; | 748 this._previousHoveredElement.hovered = false; |
734 delete this._previousHoveredElement; | 749 delete this._previousHoveredElement; |
735 } | 750 } |
736 | 751 |
737 if (element) { | 752 if (treeElement) { |
738 element.hovered = true; | 753 treeElement.hovered = true; |
739 this._previousHoveredElement = element; | 754 this._previousHoveredElement = treeElement; |
740 } | 755 } |
| 756 }, |
| 757 |
| 758 _onmousemove: function(event) |
| 759 { |
| 760 var element = this._treeElementFromEvent(event); |
| 761 if (element && this._previousHoveredElement === element) |
| 762 return; |
| 763 |
| 764 this._setHoverEffect(element); |
741 | 765 |
742 if (element instanceof WebInspector.ElementsTreeElement) { | 766 if (element instanceof WebInspector.ElementsTreeElement) { |
743 this._domModel.highlightDOMNodeWithConfig(element.node().id, { mode:
"all", showInfo: !WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) }); | 767 this._domModel.highlightDOMNodeWithConfig(element.node().id, { mode:
"all", showInfo: !WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) }); |
744 return; | 768 return; |
745 } | 769 } |
746 | 770 |
747 if (element instanceof WebInspector.ElementsTreeOutline.ShortcutTreeElem
ent) | 771 if (element instanceof WebInspector.ElementsTreeOutline.ShortcutTreeElem
ent) |
748 this._domModel.highlightDOMNodeWithConfig(undefined, { mode: "all",
showInfo: !WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) }, element.ba
ckendNodeId()); | 772 this._domModel.highlightDOMNodeWithConfig(undefined, { mode: "all",
showInfo: !WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) }, element.ba
ckendNodeId()); |
749 }, | 773 }, |
750 | 774 |
751 _onmouseleave: function(event) | 775 _onmouseleave: function(event) |
752 { | 776 { |
753 if (this._previousHoveredElement) { | 777 this._setHoverEffect(null); |
754 this._previousHoveredElement.hovered = false; | |
755 delete this._previousHoveredElement; | |
756 } | |
757 | |
758 WebInspector.DOMModel.hideDOMNodeHighlight(); | 778 WebInspector.DOMModel.hideDOMNodeHighlight(); |
759 }, | 779 }, |
760 | 780 |
761 _ondragstart: function(event) | 781 _ondragstart: function(event) |
762 { | 782 { |
763 if (!event.target.isComponentSelectionCollapsed()) | 783 if (!event.target.isComponentSelectionCollapsed()) |
764 return false; | 784 return false; |
765 if (event.target.nodeName === "A") | 785 if (event.target.nodeName === "A") |
766 return false; | 786 return false; |
767 | 787 |
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1834 if (node) { | 1854 if (node) { |
1835 this.treeOutline._selectedDOMNode = node; | 1855 this.treeOutline._selectedDOMNode = node; |
1836 this.treeOutline._selectedNodeChanged(); | 1856 this.treeOutline._selectedNodeChanged(); |
1837 } | 1857 } |
1838 } | 1858 } |
1839 return true; | 1859 return true; |
1840 }, | 1860 }, |
1841 | 1861 |
1842 __proto__: TreeElement.prototype | 1862 __proto__: TreeElement.prototype |
1843 } | 1863 } |
OLD | NEW |