| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 this._domModel = target.domModel; | 42 this._domModel = target.domModel; |
| 43 var element = createElement("div"); | 43 var element = createElement("div"); |
| 44 | 44 |
| 45 this._shadowRoot = element.createShadowRoot(); | 45 this._shadowRoot = element.createShadowRoot(); |
| 46 this._shadowRoot.appendChild(WebInspector.View.createStyleElement("elements/
elementsTreeOutline.css")); | 46 this._shadowRoot.appendChild(WebInspector.View.createStyleElement("elements/
elementsTreeOutline.css")); |
| 47 | 47 |
| 48 var outlineDisclosureElement = this._shadowRoot.createChild("div", "componen
t-root outline-disclosure source-code"); | 48 var outlineDisclosureElement = this._shadowRoot.createChild("div", "componen
t-root outline-disclosure source-code"); |
| 49 this._element = outlineDisclosureElement.createChild("ol", "elements-tree-ou
tline"); | 49 this._element = outlineDisclosureElement.createChild("ol", "elements-tree-ou
tline"); |
| 50 this._element.addEventListener("mousedown", this._onmousedown.bind(this), fa
lse); | 50 this._element.addEventListener("mousedown", this._onmousedown.bind(this), fa
lse); |
| 51 this._element.addEventListener("mousemove", this._onmousemove.bind(this), fa
lse); | 51 this._element.addEventListener("mousemove", this._onmousemove.bind(this), fa
lse); |
| 52 this._element.addEventListener("mouseout", this._onmouseout.bind(this), fals
e); | 52 this._element.addEventListener("mouseleave", this._onmouseleave.bind(this),
false); |
| 53 this._element.addEventListener("dragstart", this._ondragstart.bind(this), fa
lse); | 53 this._element.addEventListener("dragstart", this._ondragstart.bind(this), fa
lse); |
| 54 this._element.addEventListener("dragover", this._ondragover.bind(this), fals
e); | 54 this._element.addEventListener("dragover", this._ondragover.bind(this), fals
e); |
| 55 this._element.addEventListener("dragleave", this._ondragleave.bind(this), fa
lse); | 55 this._element.addEventListener("dragleave", this._ondragleave.bind(this), fa
lse); |
| 56 this._element.addEventListener("drop", this._ondrop.bind(this), false); | 56 this._element.addEventListener("drop", this._ondrop.bind(this), false); |
| 57 this._element.addEventListener("dragend", this._ondragend.bind(this), false)
; | 57 this._element.addEventListener("dragend", this._ondragend.bind(this), false)
; |
| 58 this._element.addEventListener("keydown", this._onkeydown.bind(this), false)
; | 58 this._element.addEventListener("keydown", this._onkeydown.bind(this), false)
; |
| 59 this._element.addEventListener("webkitAnimationEnd", this._onAnimationEnd.bi
nd(this), false); | 59 this._element.addEventListener("webkitAnimationEnd", this._onAnimationEnd.bi
nd(this), false); |
| 60 this._element.addEventListener("contextmenu", this._contextMenuEventFired.bi
nd(this), false); | 60 this._element.addEventListener("contextmenu", this._contextMenuEventFired.bi
nd(this), false); |
| 61 | 61 |
| 62 TreeOutline.call(this, this._element); | 62 TreeOutline.call(this, this._element); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 */ | 225 */ |
| 226 handleCopyOrCutKeyboardEvent: function(isCut, event) | 226 handleCopyOrCutKeyboardEvent: function(isCut, event) |
| 227 { | 227 { |
| 228 this._setClipboardData(null); | 228 this._setClipboardData(null); |
| 229 | 229 |
| 230 // Don't prevent the normal copy if the user has a selection. | 230 // Don't prevent the normal copy if the user has a selection. |
| 231 if (!window.getSelection().isCollapsed) | 231 if (!window.getSelection().isCollapsed) |
| 232 return; | 232 return; |
| 233 | 233 |
| 234 // Do not interfere with text editing. | 234 // Do not interfere with text editing. |
| 235 var currentFocusElement = WebInspector.currentFocusElement(); | 235 if (WebInspector.isEditing()) |
| 236 if (currentFocusElement && WebInspector.isBeingEdited(currentFocusElemen
t)) | |
| 237 return; | 236 return; |
| 238 | 237 |
| 239 var targetNode = this.selectedDOMNode(); | 238 var targetNode = this.selectedDOMNode(); |
| 240 if (!targetNode) | 239 if (!targetNode) |
| 241 return; | 240 return; |
| 242 | 241 |
| 243 event.clipboardData.clearData(); | 242 event.clipboardData.clearData(); |
| 244 event.preventDefault(); | 243 event.preventDefault(); |
| 245 | 244 |
| 246 this._performCopyOrCut(isCut, targetNode); | 245 this._performCopyOrCut(isCut, targetNode); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 if (this._canPaste(targetNode)) | 287 if (this._canPaste(targetNode)) |
| 289 this._performPaste(targetNode); | 288 this._performPaste(targetNode); |
| 290 }, | 289 }, |
| 291 | 290 |
| 292 /** | 291 /** |
| 293 * @param {!Event} event | 292 * @param {!Event} event |
| 294 */ | 293 */ |
| 295 handlePasteKeyboardEvent: function(event) | 294 handlePasteKeyboardEvent: function(event) |
| 296 { | 295 { |
| 297 // Do not interfere with text editing. | 296 // Do not interfere with text editing. |
| 298 var currentFocusElement = WebInspector.currentFocusElement(); | 297 if (WebInspector.isEditing()) |
| 299 if (currentFocusElement && WebInspector.isBeingEdited(currentFocusElemen
t)) | |
| 300 return; | 298 return; |
| 301 | 299 |
| 302 var targetNode = this.selectedDOMNode(); | 300 var targetNode = this.selectedDOMNode(); |
| 303 if (!targetNode || !this._canPaste(targetNode)) | 301 if (!targetNode || !this._canPaste(targetNode)) |
| 304 return; | 302 return; |
| 305 | 303 |
| 306 event.preventDefault(); | 304 event.preventDefault(); |
| 307 this._performPaste(targetNode); | 305 this._performPaste(targetNode); |
| 308 }, | 306 }, |
| 309 | 307 |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 element.hovered = true; | 604 element.hovered = true; |
| 607 this._previousHoveredElement = element; | 605 this._previousHoveredElement = element; |
| 608 } | 606 } |
| 609 | 607 |
| 610 if (element && element._node) | 608 if (element && element._node) |
| 611 this._domModel.highlightDOMNodeWithConfig(element._node.id, { mode:
"all", showInfo: !WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) }); | 609 this._domModel.highlightDOMNodeWithConfig(element._node.id, { mode:
"all", showInfo: !WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) }); |
| 612 else | 610 else |
| 613 this._domModel.hideDOMNodeHighlight(); | 611 this._domModel.hideDOMNodeHighlight(); |
| 614 }, | 612 }, |
| 615 | 613 |
| 616 _onmouseout: function(event) | 614 _onmouseleave: function(event) |
| 617 { | 615 { |
| 618 var nodeUnderMouse = event.deepElementFromPoint(); | |
| 619 if (nodeUnderMouse && nodeUnderMouse.isDescendant(this._element)) | |
| 620 return; | |
| 621 | |
| 622 if (this._previousHoveredElement) { | 616 if (this._previousHoveredElement) { |
| 623 this._previousHoveredElement.hovered = false; | 617 this._previousHoveredElement.hovered = false; |
| 624 delete this._previousHoveredElement; | 618 delete this._previousHoveredElement; |
| 625 } | 619 } |
| 626 | 620 |
| 627 this._domModel.hideDOMNodeHighlight(); | 621 this._domModel.hideDOMNodeHighlight(); |
| 628 }, | 622 }, |
| 629 | 623 |
| 630 _ondragstart: function(event) | 624 _ondragstart: function(event) |
| 631 { | 625 { |
| (...skipping 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2954 treeOutline.rootDOMNode = node; | 2948 treeOutline.rootDOMNode = node; |
| 2955 if (!treeOutline.children[0].hasChildren) | 2949 if (!treeOutline.children[0].hasChildren) |
| 2956 treeOutline._element.classList.add("single-node"); | 2950 treeOutline._element.classList.add("single-node"); |
| 2957 treeOutline.setVisible(true); | 2951 treeOutline.setVisible(true); |
| 2958 treeOutline.element.treeElementForTest = treeOutline.children[0]
; | 2952 treeOutline.element.treeElementForTest = treeOutline.children[0]
; |
| 2959 resolve(treeOutline.element); | 2953 resolve(treeOutline.element); |
| 2960 } | 2954 } |
| 2961 } | 2955 } |
| 2962 } | 2956 } |
| 2963 } | 2957 } |
| OLD | NEW |