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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 if (this._previousHoveredElement) { | 390 if (this._previousHoveredElement) { |
391 this._previousHoveredElement.hovered = false; | 391 this._previousHoveredElement.hovered = false; |
392 delete this._previousHoveredElement; | 392 delete this._previousHoveredElement; |
393 } | 393 } |
394 | 394 |
395 if (element) { | 395 if (element) { |
396 element.hovered = true; | 396 element.hovered = true; |
397 this._previousHoveredElement = element; | 397 this._previousHoveredElement = element; |
398 } | 398 } |
399 | 399 |
400 WebInspector.domAgent.highlightDOMNode(element && element._node ? elemen
t._node.id : 0); | 400 WebInspector.domModel.highlightDOMNode(element && element._node ? elemen
t._node.id : 0); |
401 }, | 401 }, |
402 | 402 |
403 _onmouseout: function(event) | 403 _onmouseout: function(event) |
404 { | 404 { |
405 var nodeUnderMouse = document.elementFromPoint(event.pageX, event.pageY)
; | 405 var nodeUnderMouse = document.elementFromPoint(event.pageX, event.pageY)
; |
406 if (nodeUnderMouse && nodeUnderMouse.isDescendant(this.element)) | 406 if (nodeUnderMouse && nodeUnderMouse.isDescendant(this.element)) |
407 return; | 407 return; |
408 | 408 |
409 if (this._previousHoveredElement) { | 409 if (this._previousHoveredElement) { |
410 this._previousHoveredElement.hovered = false; | 410 this._previousHoveredElement.hovered = false; |
411 delete this._previousHoveredElement; | 411 delete this._previousHoveredElement; |
412 } | 412 } |
413 | 413 |
414 WebInspector.domAgent.hideDOMNodeHighlight(); | 414 WebInspector.domModel.hideDOMNodeHighlight(); |
415 }, | 415 }, |
416 | 416 |
417 _ondragstart: function(event) | 417 _ondragstart: function(event) |
418 { | 418 { |
419 if (!window.getSelection().isCollapsed) | 419 if (!window.getSelection().isCollapsed) |
420 return false; | 420 return false; |
421 if (event.target.nodeName === "A") | 421 if (event.target.nodeName === "A") |
422 return false; | 422 return false; |
423 | 423 |
424 var treeElement = this._treeElementFromEvent(event); | 424 var treeElement = this._treeElementFromEvent(event); |
425 if (!treeElement) | 425 if (!treeElement) |
426 return false; | 426 return false; |
427 | 427 |
428 if (!this._isValidDragSourceOrTarget(treeElement)) | 428 if (!this._isValidDragSourceOrTarget(treeElement)) |
429 return false; | 429 return false; |
430 | 430 |
431 if (treeElement._node.nodeName() === "BODY" || treeElement._node.nodeNam
e() === "HEAD") | 431 if (treeElement._node.nodeName() === "BODY" || treeElement._node.nodeNam
e() === "HEAD") |
432 return false; | 432 return false; |
433 | 433 |
434 event.dataTransfer.setData("text/plain", treeElement.listItemElement.tex
tContent); | 434 event.dataTransfer.setData("text/plain", treeElement.listItemElement.tex
tContent); |
435 event.dataTransfer.effectAllowed = "copyMove"; | 435 event.dataTransfer.effectAllowed = "copyMove"; |
436 this._treeElementBeingDragged = treeElement; | 436 this._treeElementBeingDragged = treeElement; |
437 | 437 |
438 WebInspector.domAgent.hideDOMNodeHighlight(); | 438 WebInspector.domModel.hideDOMNodeHighlight(); |
439 | 439 |
440 return true; | 440 return true; |
441 }, | 441 }, |
442 | 442 |
443 _ondragover: function(event) | 443 _ondragover: function(event) |
444 { | 444 { |
445 if (!this._treeElementBeingDragged) | 445 if (!this._treeElementBeingDragged) |
446 return false; | 446 return false; |
447 | 447 |
448 var treeElement = this._treeElementFromEvent(event); | 448 var treeElement = this._treeElementFromEvent(event); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 * @param {!DOMAgent.NodeId=} nodeId | 659 * @param {!DOMAgent.NodeId=} nodeId |
660 */ | 660 */ |
661 _selectNodeAfterEdit: function(wasExpanded, error, nodeId) | 661 _selectNodeAfterEdit: function(wasExpanded, error, nodeId) |
662 { | 662 { |
663 if (error) | 663 if (error) |
664 return; | 664 return; |
665 | 665 |
666 // Select it and expand if necessary. We force tree update so that it pr
ocesses dom events and is up to date. | 666 // Select it and expand if necessary. We force tree update so that it pr
ocesses dom events and is up to date. |
667 this._updateModifiedNodes(); | 667 this._updateModifiedNodes(); |
668 | 668 |
669 var newNode = nodeId ? WebInspector.domAgent.nodeForId(nodeId) : null; | 669 var newNode = nodeId ? WebInspector.domModel.nodeForId(nodeId) : null; |
670 if (!newNode) | 670 if (!newNode) |
671 return; | 671 return; |
672 | 672 |
673 this.selectDOMNode(newNode, true); | 673 this.selectDOMNode(newNode, true); |
674 | 674 |
675 var newTreeItem = this.findTreeElement(newNode); | 675 var newTreeItem = this.findTreeElement(newNode); |
676 if (wasExpanded) { | 676 if (wasExpanded) { |
677 if (newTreeItem) | 677 if (newTreeItem) |
678 newTreeItem.expand(); | 678 newTreeItem.expand(); |
679 } | 679 } |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 /** | 1245 /** |
1246 * @override | 1246 * @override |
1247 * @param {boolean=} selectedByUser | 1247 * @param {boolean=} selectedByUser |
1248 * @return {boolean} | 1248 * @return {boolean} |
1249 */ | 1249 */ |
1250 onselect: function(selectedByUser) | 1250 onselect: function(selectedByUser) |
1251 { | 1251 { |
1252 this.treeOutline.suppressRevealAndSelect = true; | 1252 this.treeOutline.suppressRevealAndSelect = true; |
1253 this.treeOutline.selectDOMNode(this._node, selectedByUser); | 1253 this.treeOutline.selectDOMNode(this._node, selectedByUser); |
1254 if (selectedByUser) | 1254 if (selectedByUser) |
1255 WebInspector.domAgent.highlightDOMNode(this._node.id); | 1255 WebInspector.domModel.highlightDOMNode(this._node.id); |
1256 this.updateSelection(); | 1256 this.updateSelection(); |
1257 this.treeOutline.suppressRevealAndSelect = false; | 1257 this.treeOutline.suppressRevealAndSelect = false; |
1258 return true; | 1258 return true; |
1259 }, | 1259 }, |
1260 | 1260 |
1261 /** | 1261 /** |
1262 * @override | 1262 * @override |
1263 * @return {boolean} | 1263 * @return {boolean} |
1264 */ | 1264 */ |
1265 ondelete: function() | 1265 ondelete: function() |
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2373 } | 2373 } |
2374 | 2374 |
2375 if (object) | 2375 if (object) |
2376 object.callFunction(scrollIntoView); | 2376 object.callFunction(scrollIntoView); |
2377 } | 2377 } |
2378 | 2378 |
2379 WebInspector.RemoteObject.resolveNode(this._node, "", scrollIntoViewCall
back); | 2379 WebInspector.RemoteObject.resolveNode(this._node, "", scrollIntoViewCall
back); |
2380 }, | 2380 }, |
2381 | 2381 |
2382 /** | 2382 /** |
2383 * @return {!Array.<!WebInspector.DOMAgent>} | 2383 * @return {!Array.<!WebInspector.DOMModel>} |
2384 */ | 2384 */ |
2385 _visibleShadowRoots: function() | 2385 _visibleShadowRoots: function() |
2386 { | 2386 { |
2387 var roots = this._node.shadowRoots(); | 2387 var roots = this._node.shadowRoots(); |
2388 if (roots.length && !WebInspector.settings.showUAShadowDOM.get()) { | 2388 if (roots.length && !WebInspector.settings.showUAShadowDOM.get()) { |
2389 roots = roots.filter(function(root) { | 2389 roots = roots.filter(function(root) { |
2390 return root.shadowRootType() === WebInspector.DOMNode.ShadowRoot
Types.Author; | 2390 return root.shadowRootType() === WebInspector.DOMNode.ShadowRoot
Types.Author; |
2391 }); | 2391 }); |
2392 } | 2392 } |
2393 return roots; | 2393 return roots; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2435 | 2435 |
2436 __proto__: TreeElement.prototype | 2436 __proto__: TreeElement.prototype |
2437 } | 2437 } |
2438 | 2438 |
2439 /** | 2439 /** |
2440 * @constructor | 2440 * @constructor |
2441 * @param {!WebInspector.ElementsTreeOutline} treeOutline | 2441 * @param {!WebInspector.ElementsTreeOutline} treeOutline |
2442 */ | 2442 */ |
2443 WebInspector.ElementsTreeUpdater = function(treeOutline) | 2443 WebInspector.ElementsTreeUpdater = function(treeOutline) |
2444 { | 2444 { |
2445 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.NodeInse
rted, this._nodeInserted, this); | 2445 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.NodeInse
rted, this._nodeInserted, this); |
2446 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.NodeRemo
ved, this._nodeRemoved, this); | 2446 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.NodeRemo
ved, this._nodeRemoved, this); |
2447 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrModi
fied, this._attributesUpdated, this); | 2447 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.AttrModi
fied, this._attributesUpdated, this); |
2448 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrRemo
ved, this._attributesUpdated, this); | 2448 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.AttrRemo
ved, this._attributesUpdated, this); |
2449 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.Characte
rDataModified, this._characterDataModified, this); | 2449 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.Characte
rDataModified, this._characterDataModified, this); |
2450 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.Document
Updated, this._documentUpdated, this); | 2450 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.Document
Updated, this._documentUpdated, this); |
2451 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.ChildNod
eCountUpdated, this._childNodeCountUpdated, this); | 2451 WebInspector.domModel.addEventListener(WebInspector.DOMModel.Events.ChildNod
eCountUpdated, this._childNodeCountUpdated, this); |
2452 | 2452 |
2453 this._treeOutline = treeOutline; | 2453 this._treeOutline = treeOutline; |
2454 /** @type {!Map.<!WebInspector.DOMNode, !WebInspector.ElementsTreeUpdater.Up
dateEntry>} */ | 2454 /** @type {!Map.<!WebInspector.DOMNode, !WebInspector.ElementsTreeUpdater.Up
dateEntry>} */ |
2455 this._recentlyModifiedNodes = new Map(); | 2455 this._recentlyModifiedNodes = new Map(); |
2456 } | 2456 } |
2457 | 2457 |
2458 WebInspector.ElementsTreeUpdater.prototype = { | 2458 WebInspector.ElementsTreeUpdater.prototype = { |
2459 /** | 2459 /** |
2460 * @param {!WebInspector.DOMNode} node | 2460 * @param {!WebInspector.DOMNode} node |
2461 * @param {boolean} isUpdated | 2461 * @param {boolean} isUpdated |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2582 } | 2582 } |
2583 this._recentlyModifiedNodes.clear(); | 2583 this._recentlyModifiedNodes.clear(); |
2584 | 2584 |
2585 this._treeOutline._fireElementsTreeUpdated(nodes); | 2585 this._treeOutline._fireElementsTreeUpdated(nodes); |
2586 }, | 2586 }, |
2587 | 2587 |
2588 _reset: function() | 2588 _reset: function() |
2589 { | 2589 { |
2590 this._treeOutline.rootDOMNode = null; | 2590 this._treeOutline.rootDOMNode = null; |
2591 this._treeOutline.selectDOMNode(null, false); | 2591 this._treeOutline.selectDOMNode(null, false); |
2592 WebInspector.domAgent.hideDOMNodeHighlight(); | 2592 WebInspector.domModel.hideDOMNodeHighlight(); |
2593 this._recentlyModifiedNodes.clear(); | 2593 this._recentlyModifiedNodes.clear(); |
2594 } | 2594 } |
2595 } | 2595 } |
2596 | 2596 |
2597 /** | 2597 /** |
2598 * @constructor | 2598 * @constructor |
2599 * @param {boolean} isUpdated | 2599 * @param {boolean} isUpdated |
2600 * @param {!WebInspector.DOMNode=} parent | 2600 * @param {!WebInspector.DOMNode=} parent |
2601 */ | 2601 */ |
2602 WebInspector.ElementsTreeUpdater.UpdateEntry = function(isUpdated, parent) | 2602 WebInspector.ElementsTreeUpdater.UpdateEntry = function(isUpdated, parent) |
(...skipping 23 matching lines...) Expand all Loading... |
2626 var treeOutline = new WebInspector.ElementsTreeOutline(false, false); | 2626 var treeOutline = new WebInspector.ElementsTreeOutline(false, false); |
2627 treeOutline.rootDOMNode = /** @type {!WebInspector.DOMNode} */ (object); | 2627 treeOutline.rootDOMNode = /** @type {!WebInspector.DOMNode} */ (object); |
2628 treeOutline.element.classList.add("outline-disclosure"); | 2628 treeOutline.element.classList.add("outline-disclosure"); |
2629 if (!treeOutline.children[0].hasChildren) | 2629 if (!treeOutline.children[0].hasChildren) |
2630 treeOutline.element.classList.add("single-node"); | 2630 treeOutline.element.classList.add("single-node"); |
2631 treeOutline.setVisible(true); | 2631 treeOutline.setVisible(true); |
2632 treeOutline.element.treeElementForTest = treeOutline.children[0]; | 2632 treeOutline.element.treeElementForTest = treeOutline.children[0]; |
2633 return treeOutline.element; | 2633 return treeOutline.element; |
2634 } | 2634 } |
2635 } | 2635 } |
OLD | NEW |