Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(663)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js

Issue 2567573002: DevTools: fix private field usage violation discovered after the compiler roll. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 525
526 contextMenu.appendItem(Common.UIString('Expand all'), this.expandRecursively .bind(this)); 526 contextMenu.appendItem(Common.UIString('Expand all'), this.expandRecursively .bind(this));
527 contextMenu.appendItem(Common.UIString('Collapse all'), this.collapseRecursi vely.bind(this)); 527 contextMenu.appendItem(Common.UIString('Collapse all'), this.collapseRecursi vely.bind(this));
528 contextMenu.appendSeparator(); 528 contextMenu.appendSeparator();
529 } 529 }
530 530
531 _startEditing() { 531 _startEditing() {
532 if (this.treeOutline.selectedDOMNode() !== this._node) 532 if (this.treeOutline.selectedDOMNode() !== this._node)
533 return; 533 return;
534 534
535 var listItem = this._listItemNode; 535 var listItem = this.listItemElement;
536 536
537 if (this._canAddAttributes) { 537 if (this._canAddAttributes) {
538 var attribute = listItem.getElementsByClassName('webkit-html-attribute')[0 ]; 538 var attribute = listItem.getElementsByClassName('webkit-html-attribute')[0 ];
539 if (attribute) { 539 if (attribute) {
540 return this._startEditingAttribute( 540 return this._startEditingAttribute(
541 attribute, attribute.getElementsByClassName('webkit-html-attribute-v alue')[0]); 541 attribute, attribute.getElementsByClassName('webkit-html-attribute-v alue')[0]);
542 } 542 }
543 543
544 return this._addNewAttribute(); 544 return this._addNewAttribute();
545 } 545 }
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 this._htmlEditElement = createElement('div'); 742 this._htmlEditElement = createElement('div');
743 this._htmlEditElement.className = 'source-code elements-tree-editor'; 743 this._htmlEditElement.className = 'source-code elements-tree-editor';
744 744
745 // Hide header items. 745 // Hide header items.
746 var child = this.listItemElement.firstChild; 746 var child = this.listItemElement.firstChild;
747 while (child) { 747 while (child) {
748 child.style.display = 'none'; 748 child.style.display = 'none';
749 child = child.nextSibling; 749 child = child.nextSibling;
750 } 750 }
751 // Hide children item. 751 // Hide children item.
752 if (this._childrenListNode) 752 if (this.childrenListElement)
753 this._childrenListNode.style.display = 'none'; 753 this.childrenListElement.style.display = 'none';
754 // Append editor. 754 // Append editor.
755 this.listItemElement.appendChild(this._htmlEditElement); 755 this.listItemElement.appendChild(this._htmlEditElement);
756 this.listItemElement.classList.add('editing-as-html'); 756 this.listItemElement.classList.add('editing-as-html');
757 this.treeOutline.element.addEventListener('mousedown', consume, false); 757 this.treeOutline.element.addEventListener('mousedown', consume, false);
758 758
759 /** 759 /**
760 * @param {!Element} element 760 * @param {!Element} element
761 * @param {string} newValue 761 * @param {string} newValue
762 * @this {Elements.ElementsTreeElement} 762 * @this {Elements.ElementsTreeElement}
763 */ 763 */
764 function commit(element, newValue) { 764 function commit(element, newValue) {
765 commitCallback(initialValue, newValue); 765 commitCallback(initialValue, newValue);
766 dispose.call(this); 766 dispose.call(this);
767 } 767 }
768 768
769 /** 769 /**
770 * @this {Elements.ElementsTreeElement} 770 * @this {Elements.ElementsTreeElement}
771 */ 771 */
772 function dispose() { 772 function dispose() {
773 disposeCallback(); 773 disposeCallback();
774 delete this._editing; 774 delete this._editing;
775 this.treeOutline.setMultilineEditing(null); 775 this.treeOutline.setMultilineEditing(null);
776 776
777 this.listItemElement.classList.remove('editing-as-html'); 777 this.listItemElement.classList.remove('editing-as-html');
778 // Remove editor. 778 // Remove editor.
779 this.listItemElement.removeChild(this._htmlEditElement); 779 this.listItemElement.removeChild(this._htmlEditElement);
780 delete this._htmlEditElement; 780 delete this._htmlEditElement;
781 // Unhide children item. 781 // Unhide children item.
782 if (this._childrenListNode) 782 if (this.childrenListElement)
783 this._childrenListNode.style.removeProperty('display'); 783 this.childrenListElement.style.removeProperty('display');
784 // Unhide header items. 784 // Unhide header items.
785 var child = this.listItemElement.firstChild; 785 var child = this.listItemElement.firstChild;
786 while (child) { 786 while (child) {
787 child.style.removeProperty('display'); 787 child.style.removeProperty('display');
788 child = child.nextSibling; 788 child = child.nextSibling;
789 } 789 }
790 790
791 this.treeOutline.element.removeEventListener('mousedown', consume, false); 791 this.treeOutline.element.removeEventListener('mousedown', consume, false);
792 this.treeOutline.focus(); 792 this.treeOutline.focus();
793 } 793 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 954
955 /** 955 /**
956 * @return {!Element} 956 * @return {!Element}
957 */ 957 */
958 _distinctClosingTagElement() { 958 _distinctClosingTagElement() {
959 // FIXME: Improve the Tree Element / Outline Abstraction to prevent crawling the DOM 959 // FIXME: Improve the Tree Element / Outline Abstraction to prevent crawling the DOM
960 960
961 // For an expanded element, it will be the last element with class "close" 961 // For an expanded element, it will be the last element with class "close"
962 // in the child element list. 962 // in the child element list.
963 if (this.expanded) { 963 if (this.expanded) {
964 var closers = this._childrenListNode.querySelectorAll('.close'); 964 var closers = this.childrenListElement.querySelectorAll('.close');
965 return closers[closers.length - 1]; 965 return closers[closers.length - 1];
966 } 966 }
967 967
968 // Remaining cases are single line non-expanded elements with a closing 968 // Remaining cases are single line non-expanded elements with a closing
969 // tag, or HTML elements without a closing tag (such as <br>). Return 969 // tag, or HTML elements without a closing tag (such as <br>). Return
970 // null in the case where there isn't a closing tag. 970 // null in the case where there isn't a closing tag.
971 var tags = this.listItemElement.getElementsByClassName('webkit-html-tag'); 971 var tags = this.listItemElement.getElementsByClassName('webkit-html-tag');
972 return (tags.length === 1 ? null : tags[tags.length - 1]); 972 return (tags.length === 1 ? null : tags[tags.length - 1]);
973 } 973 }
974 974
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
1564 1564
1565 // A union of HTML4 and HTML5-Draft elements that explicitly 1565 // A union of HTML4 and HTML5-Draft elements that explicitly
1566 // or implicitly (for HTML5) forbid the closing tag. 1566 // or implicitly (for HTML5) forbid the closing tag.
1567 Elements.ElementsTreeElement.ForbiddenClosingTagElements = new Set([ 1567 Elements.ElementsTreeElement.ForbiddenClosingTagElements = new Set([
1568 'area', 'base', 'basefont', 'br', 'canvas', 'col', 'command', 'embed', 'frame', 'hr', 1568 'area', 'base', 'basefont', 'br', 'canvas', 'col', 'command', 'embed', 'frame', 'hr',
1569 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr' 1569 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'
1570 ]); 1570 ]);
1571 1571
1572 // These tags we do not allow editing their tag name. 1572 // These tags we do not allow editing their tag name.
1573 Elements.ElementsTreeElement.EditTagBlacklist = new Set(['html', 'head', 'body'] ); 1573 Elements.ElementsTreeElement.EditTagBlacklist = new Set(['html', 'head', 'body'] );
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698