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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 { | 442 { |
443 return !this._node.isShadowRoot() && !this._node.ancestorUserAgentShadow
Root(); | 443 return !this._node.isShadowRoot() && !this._node.ancestorUserAgentShadow
Root(); |
444 }, | 444 }, |
445 | 445 |
446 _insertInLastAttributePosition: function(tag, node) | 446 _insertInLastAttributePosition: function(tag, node) |
447 { | 447 { |
448 if (tag.getElementsByClassName("webkit-html-attribute").length > 0) | 448 if (tag.getElementsByClassName("webkit-html-attribute").length > 0) |
449 tag.insertBefore(node, tag.lastChild); | 449 tag.insertBefore(node, tag.lastChild); |
450 else { | 450 else { |
451 var nodeName = tag.textContent.match(/^<(.*?)>$/)[1]; | 451 var nodeName = tag.textContent.match(/^<(.*?)>$/)[1]; |
452 tag.textContent = ''; | 452 tag.textContent = ""; |
453 tag.createTextChild('<' + nodeName); | 453 tag.createTextChild("<" + nodeName); |
454 tag.appendChild(node); | 454 tag.appendChild(node); |
455 tag.createTextChild('>'); | 455 tag.createTextChild(">"); |
456 } | 456 } |
457 | 457 |
458 this.updateSelection(); | 458 this.updateSelection(); |
459 }, | 459 }, |
460 | 460 |
461 /** | 461 /** |
462 * @param {!Element} eventTarget | 462 * @param {!Element} eventTarget |
463 * @return {boolean} | 463 * @return {boolean} |
464 */ | 464 */ |
465 _startEditingTarget: function(eventTarget) | 465 _startEditingTarget: function(eventTarget) |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 closingTagElement.textContent = "</" + tagNameElement.textConten
t + ">"; | 739 closingTagElement.textContent = "</" + tagNameElement.textConten
t + ">"; |
740 } | 740 } |
741 | 741 |
742 /** | 742 /** |
743 * @param {!Element} element | 743 * @param {!Element} element |
744 * @param {string} newTagName | 744 * @param {string} newTagName |
745 * @this {WebInspector.ElementsTreeElement} | 745 * @this {WebInspector.ElementsTreeElement} |
746 */ | 746 */ |
747 function editingComitted(element, newTagName) | 747 function editingComitted(element, newTagName) |
748 { | 748 { |
749 tagNameElement.removeEventListener('keyup', keyupListener, false); | 749 tagNameElement.removeEventListener("keyup", keyupListener, false); |
750 this._tagNameEditingCommitted.apply(this, arguments); | 750 this._tagNameEditingCommitted.apply(this, arguments); |
751 } | 751 } |
752 | 752 |
753 /** | 753 /** |
754 * @this {WebInspector.ElementsTreeElement} | 754 * @this {WebInspector.ElementsTreeElement} |
755 */ | 755 */ |
756 function editingCancelled() | 756 function editingCancelled() |
757 { | 757 { |
758 tagNameElement.removeEventListener('keyup', keyupListener, false); | 758 tagNameElement.removeEventListener("keyup", keyupListener, false); |
759 this._editingCancelled.apply(this, arguments); | 759 this._editingCancelled.apply(this, arguments); |
760 } | 760 } |
761 | 761 |
762 tagNameElement.addEventListener('keyup', keyupListener, false); | 762 tagNameElement.addEventListener("keyup", keyupListener, false); |
763 | 763 |
764 var config = new WebInspector.InplaceEditor.Config(editingComitted.bind(
this), editingCancelled.bind(this), tagName); | 764 var config = new WebInspector.InplaceEditor.Config(editingComitted.bind(
this), editingCancelled.bind(this), tagName); |
765 this._editing = WebInspector.InplaceEditor.startEditing(tagNameElement,
config); | 765 this._editing = WebInspector.InplaceEditor.startEditing(tagNameElement,
config); |
766 this.listItemElement.getComponentSelection().setBaseAndExtent(tagNameEle
ment, 0, tagNameElement, 1); | 766 this.listItemElement.getComponentSelection().setBaseAndExtent(tagNameEle
ment, 0, tagNameElement, 1); |
767 return true; | 767 return true; |
768 }, | 768 }, |
769 | 769 |
770 /** | 770 /** |
771 * @param {function(string, string)} commitCallback | 771 * @param {function(string, string)} commitCallback |
772 * @param {function()} disposeCallback | 772 * @param {function()} disposeCallback |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 * @return {!Element} | 1017 * @return {!Element} |
1018 */ | 1018 */ |
1019 _distinctClosingTagElement: function() | 1019 _distinctClosingTagElement: function() |
1020 { | 1020 { |
1021 // FIXME: Improve the Tree Element / Outline Abstraction to prevent craw
ling the DOM | 1021 // FIXME: Improve the Tree Element / Outline Abstraction to prevent craw
ling the DOM |
1022 | 1022 |
1023 // For an expanded element, it will be the last element with class "clos
e" | 1023 // For an expanded element, it will be the last element with class "clos
e" |
1024 // in the child element list. | 1024 // in the child element list. |
1025 if (this.expanded) { | 1025 if (this.expanded) { |
1026 var closers = this._childrenListNode.querySelectorAll(".close"); | 1026 var closers = this._childrenListNode.querySelectorAll(".close"); |
1027 return closers[closers.length-1]; | 1027 return closers[closers.length - 1]; |
1028 } | 1028 } |
1029 | 1029 |
1030 // Remaining cases are single line non-expanded elements with a closing | 1030 // Remaining cases are single line non-expanded elements with a closing |
1031 // tag, or HTML elements without a closing tag (such as <br>). Return | 1031 // tag, or HTML elements without a closing tag (such as <br>). Return |
1032 // null in the case where there isn't a closing tag. | 1032 // null in the case where there isn't a closing tag. |
1033 var tags = this.listItemElement.getElementsByClassName("webkit-html-tag"
); | 1033 var tags = this.listItemElement.getElementsByClassName("webkit-html-tag"
); |
1034 return (tags.length === 1 ? null : tags[tags.length-1]); | 1034 return (tags.length === 1 ? null : tags[tags.length - 1]); |
1035 }, | 1035 }, |
1036 | 1036 |
1037 /** | 1037 /** |
1038 * @param {?WebInspector.ElementsTreeOutline.UpdateRecord=} updateRecord | 1038 * @param {?WebInspector.ElementsTreeOutline.UpdateRecord=} updateRecord |
1039 * @param {boolean=} onlySearchQueryChanged | 1039 * @param {boolean=} onlySearchQueryChanged |
1040 */ | 1040 */ |
1041 updateTitle: function(updateRecord, onlySearchQueryChanged) | 1041 updateTitle: function(updateRecord, onlySearchQueryChanged) |
1042 { | 1042 { |
1043 // If we are editing, return early to prevent canceling the edit. | 1043 // If we are editing, return early to prevent canceling the edit. |
1044 // After editing is committed updateTitle will be called. | 1044 // After editing is committed updateTitle will be called. |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1608 this.scrollIntoViewIfNeeded(true); | 1608 this.scrollIntoViewIfNeeded(true); |
1609 } | 1609 } |
1610 | 1610 |
1611 if (object) | 1611 if (object) |
1612 object.callFunction(scrollIntoView); | 1612 object.callFunction(scrollIntoView); |
1613 } | 1613 } |
1614 | 1614 |
1615 this._node.resolveToObject("", scrollIntoViewCallback); | 1615 this._node.resolveToObject("", scrollIntoViewCallback); |
1616 }, | 1616 }, |
1617 | 1617 |
1618 _editAsHTML: function () | 1618 _editAsHTML: function() |
1619 { | 1619 { |
1620 var promise = WebInspector.Revealer.revealPromise(this.node()); | 1620 var promise = WebInspector.Revealer.revealPromise(this.node()); |
1621 promise.then(() => WebInspector.actionRegistry.action("elements.edit-as-
html").execute()); | 1621 promise.then(() => WebInspector.actionRegistry.action("elements.edit-as-
html").execute()); |
1622 }, | 1622 }, |
1623 | 1623 |
1624 __proto__: TreeElement.prototype | 1624 __proto__: TreeElement.prototype |
1625 } | 1625 } |
OLD | NEW |