Chromium Code Reviews| 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 225 } | 225 } | 
| 226 | 226 | 
| 227 _createSelection() { | 227 _createSelection() { | 
| 228 var listItemElement = this.listItemElement; | 228 var listItemElement = this.listItemElement; | 
| 229 if (!listItemElement) | 229 if (!listItemElement) | 
| 230 return; | 230 return; | 
| 231 | 231 | 
| 232 if (!this.selectionElement) { | 232 if (!this.selectionElement) { | 
| 233 this.selectionElement = createElement('div'); | 233 this.selectionElement = createElement('div'); | 
| 234 this.selectionElement.className = 'selection fill'; | 234 this.selectionElement.className = 'selection fill'; | 
| 235 this.selectionElement.style.setProperty('margin-left', (-this._computeLeft Indent()) + 'px'); | 235 this.selectionElement.style.setProperty('margin-left', (-this.computeLeftI ndent()) + 'px'); | 
| 236 listItemElement.insertBefore(this.selectionElement, listItemElement.firstC hild); | 236 listItemElement.insertBefore(this.selectionElement, listItemElement.firstC hild); | 
| 237 } | 237 } | 
| 238 } | 238 } | 
| 239 | 239 | 
| 240 /** | 240 /** | 
| 241 * @override | 241 * @override | 
| 242 */ | 242 */ | 
| 243 onbind() { | 243 onbind() { | 
| 244 if (!this._elementCloseTag) | 244 if (!this._elementCloseTag) | 
| 245 this._node[this.treeOutline.treeElementSymbol()] = this; | 245 this._node[this.treeOutline.treeElementSymbol()] = this; | 
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 796 initialValue, {name: 'xml', htmlMode: true}, 'web-inspector-html', Commo n.moduleSetting('domWordWrap').get(), | 796 initialValue, {name: 'xml', htmlMode: true}, 'web-inspector-html', Commo n.moduleSetting('domWordWrap').get(), | 
| 797 true); | 797 true); | 
| 798 UI.InplaceEditor.startMultilineEditing(this._htmlEditElement, config).then(m arkAsBeingEdited.bind(this)); | 798 UI.InplaceEditor.startMultilineEditing(this._htmlEditElement, config).then(m arkAsBeingEdited.bind(this)); | 
| 799 | 799 | 
| 800 /** | 800 /** | 
| 801 * @param {!Object} controller | 801 * @param {!Object} controller | 
| 802 * @this {Elements.ElementsTreeElement} | 802 * @this {Elements.ElementsTreeElement} | 
| 803 */ | 803 */ | 
| 804 function markAsBeingEdited(controller) { | 804 function markAsBeingEdited(controller) { | 
| 805 this._editing = /** @type {!UI.InplaceEditor.Controller} */ (controller); | 805 this._editing = /** @type {!UI.InplaceEditor.Controller} */ (controller); | 
| 806 this._editing.setWidth(this.treeOutline.visibleWidth() - this._computeLeft Indent()); | 806 this._editing.setWidth(this.treeOutline.visibleWidth() - this.computeLeftI ndent()); | 
| 807 this.treeOutline.setMultilineEditing(this._editing); | 807 this.treeOutline.setMultilineEditing(this._editing); | 
| 808 } | 808 } | 
| 809 } | 809 } | 
| 810 | 810 | 
| 811 _attributeEditingCommitted(element, newText, oldText, attributeName, moveDirec tion) { | 811 _attributeEditingCommitted(element, newText, oldText, attributeName, moveDirec tion) { | 
| 812 delete this._editing; | 812 delete this._editing; | 
| 813 | 813 | 
| 814 var treeOutline = this.treeOutline; | 814 var treeOutline = this.treeOutline; | 
| 815 | 815 | 
| 816 /** | 816 /** | 
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1008 } | 1008 } | 
| 1009 | 1009 | 
| 1010 delete this.selectionElement; | 1010 delete this.selectionElement; | 
| 1011 if (this.selected) | 1011 if (this.selected) | 
| 1012 this._createSelection(); | 1012 this._createSelection(); | 
| 1013 this._highlightSearchResults(); | 1013 this._highlightSearchResults(); | 
| 1014 } | 1014 } | 
| 1015 | 1015 | 
| 1016 /** | 1016 /** | 
| 1017 * @return {number} | 1017 * @return {number} | 
| 1018 * @override | |
| 1018 */ | 1019 */ | 
| 1019 _computeLeftIndent() { | 1020 computeLeftIndent() { | 
| 
 
dgozman
2017/01/13 01:53:42
I'm worried that this clashes with treeoutline's o
 
aboxhall
2017/01/13 02:22:03
Done.
 
 | |
| 1020 var treeElement = this.parent; | 1021 var treeElement = this.parent; | 
| 1021 var depth = 0; | 1022 var depth = 0; | 
| 1022 while (treeElement !== null) { | 1023 while (treeElement !== null) { | 
| 1023 depth++; | 1024 depth++; | 
| 1024 treeElement = treeElement.parent; | 1025 treeElement = treeElement.parent; | 
| 1025 } | 1026 } | 
| 1026 | 1027 | 
| 1027 /** Keep it in sync with elementsTreeOutline.css **/ | 1028 /** Keep it in sync with elementsTreeOutline.css **/ | 
| 1028 return 12 * (depth - 2) + (this.isExpandable() ? 1 : 12); | 1029 return 12 * (depth - 2) + (this.isExpandable() ? 1 : 12); | 
| 1029 } | 1030 } | 
| 1030 | 1031 | 
| 1031 updateDecorations() { | 1032 updateDecorations() { | 
| 1032 this._gutterContainer.style.left = (-this._computeLeftIndent()) + 'px'; | 1033 this._gutterContainer.style.left = (-this.computeLeftIndent()) + 'px'; | 
| 1033 | 1034 | 
| 1034 if (this.isClosingTag()) | 1035 if (this.isClosingTag()) | 
| 1035 return; | 1036 return; | 
| 1036 | 1037 | 
| 1037 var node = this._node; | 1038 var node = this._node; | 
| 1038 if (node.nodeType() !== Node.ELEMENT_NODE) | 1039 if (node.nodeType() !== Node.ELEMENT_NODE) | 
| 1039 return; | 1040 return; | 
| 1040 | 1041 | 
| 1041 if (!this.treeOutline._decoratorExtensions) | 1042 if (!this.treeOutline._decoratorExtensions) | 
| 1042 /** @type {!Array.<!Runtime.Extension>} */ | 1043 /** @type {!Array.<!Runtime.Extension>} */ | 
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1563 | 1564 | 
| 1564 // A union of HTML4 and HTML5-Draft elements that explicitly | 1565 // A union of HTML4 and HTML5-Draft elements that explicitly | 
| 1565 // or implicitly (for HTML5) forbid the closing tag. | 1566 // or implicitly (for HTML5) forbid the closing tag. | 
| 1566 Elements.ElementsTreeElement.ForbiddenClosingTagElements = new Set([ | 1567 Elements.ElementsTreeElement.ForbiddenClosingTagElements = new Set([ | 
| 1567 'area', 'base', 'basefont', 'br', 'canvas', 'col', 'command', 'embed', 'frame', 'hr', | 1568 'area', 'base', 'basefont', 'br', 'canvas', 'col', 'command', 'embed', 'frame', 'hr', | 
| 1568 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr' | 1569 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr' | 
| 1569 ]); | 1570 ]); | 
| 1570 | 1571 | 
| 1571 // These tags we do not allow editing their tag name. | 1572 // These tags we do not allow editing their tag name. | 
| 1572 Elements.ElementsTreeElement.EditTagBlacklist = new Set(['html', 'head', 'body'] ); | 1573 Elements.ElementsTreeElement.EditTagBlacklist = new Set(['html', 'head', 'body'] ); | 
| OLD | NEW |