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

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

Issue 2451513002: DevTools: [Elements] account for the left indent in the width of inplace editor (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 255
256 _createSelection: function() 256 _createSelection: function()
257 { 257 {
258 var listItemElement = this.listItemElement; 258 var listItemElement = this.listItemElement;
259 if (!listItemElement) 259 if (!listItemElement)
260 return; 260 return;
261 261
262 if (!this.selectionElement) { 262 if (!this.selectionElement) {
263 this.selectionElement = createElement("div"); 263 this.selectionElement = createElement("div");
264 this.selectionElement.className = "selection fill"; 264 this.selectionElement.className = "selection fill";
265 this.selectionElement.style.setProperty("margin-left", this._compute LeftIndent() + "px"); 265 this.selectionElement.style.setProperty("margin-left", (-this._compu teLeftIndent()) + "px");
266 listItemElement.insertBefore(this.selectionElement, listItemElement. firstChild); 266 listItemElement.insertBefore(this.selectionElement, listItemElement. firstChild);
267 } 267 }
268 }, 268 },
269 269
270 /** 270 /**
271 * @override 271 * @override
272 */ 272 */
273 onbind: function() 273 onbind: function()
274 { 274 {
275 if (!this._elementCloseTag) 275 if (!this._elementCloseTag)
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 config.setMultilineOptions(initialValue, { name: "xml", htmlMode: true } , "web-inspector-html", WebInspector.moduleSetting("domWordWrap").get(), true); 851 config.setMultilineOptions(initialValue, { name: "xml", htmlMode: true } , "web-inspector-html", WebInspector.moduleSetting("domWordWrap").get(), true);
852 WebInspector.InplaceEditor.startMultilineEditing(this._htmlEditElement, config).then(markAsBeingEdited.bind(this)); 852 WebInspector.InplaceEditor.startMultilineEditing(this._htmlEditElement, config).then(markAsBeingEdited.bind(this));
853 853
854 /** 854 /**
855 * @param {!Object} controller 855 * @param {!Object} controller
856 * @this {WebInspector.ElementsTreeElement} 856 * @this {WebInspector.ElementsTreeElement}
857 */ 857 */
858 function markAsBeingEdited(controller) 858 function markAsBeingEdited(controller)
859 { 859 {
860 this._editing = /** @type {!WebInspector.InplaceEditor.Controller} * / (controller); 860 this._editing = /** @type {!WebInspector.InplaceEditor.Controller} * / (controller);
861 this._editing.setWidth(this.treeOutline.visibleWidth()); 861 this._editing.setWidth(this.treeOutline.visibleWidth() - this._compu teLeftIndent());
862 this.treeOutline.setMultilineEditing(this._editing); 862 this.treeOutline.setMultilineEditing(this._editing);
863 } 863 }
864 }, 864 },
865 865
866 _attributeEditingCommitted: function(element, newText, oldText, attributeNam e, moveDirection) 866 _attributeEditingCommitted: function(element, newText, oldText, attributeNam e, moveDirection)
867 { 867 {
868 delete this._editing; 868 delete this._editing;
869 869
870 var treeOutline = this.treeOutline; 870 var treeOutline = this.treeOutline;
871 871
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 _computeLeftIndent: function() 1086 _computeLeftIndent: function()
1087 { 1087 {
1088 var treeElement = this.parent; 1088 var treeElement = this.parent;
1089 var depth = 0; 1089 var depth = 0;
1090 while (treeElement !== null) { 1090 while (treeElement !== null) {
1091 depth++; 1091 depth++;
1092 treeElement = treeElement.parent; 1092 treeElement = treeElement.parent;
1093 } 1093 }
1094 1094
1095 /** Keep it in sync with elementsTreeOutline.css **/ 1095 /** Keep it in sync with elementsTreeOutline.css **/
1096 return -12 * (depth - 2) - (this.isExpandable() ? 1 : 12); 1096 return 12 * (depth - 2) + (this.isExpandable() ? 1 : 12);
1097 }, 1097 },
1098 1098
1099 updateDecorations: function() 1099 updateDecorations: function()
1100 { 1100 {
1101 this._gutterContainer.style.left = this._computeLeftIndent() + "px"; 1101 this._gutterContainer.style.left = (-this._computeLeftIndent()) + "px";
1102 1102
1103 if (this.isClosingTag()) 1103 if (this.isClosingTag())
1104 return; 1104 return;
1105 1105
1106 var node = this._node; 1106 var node = this._node;
1107 if (node.nodeType() !== Node.ELEMENT_NODE) 1107 if (node.nodeType() !== Node.ELEMENT_NODE)
1108 return; 1108 return;
1109 1109
1110 if (!this.treeOutline._decoratorExtensions) 1110 if (!this.treeOutline._decoratorExtensions)
1111 /** @type {!Array.<!Runtime.Extension>} */ 1111 /** @type {!Array.<!Runtime.Extension>} */
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 }, 1635 },
1636 1636
1637 _editAsHTML: function() 1637 _editAsHTML: function()
1638 { 1638 {
1639 var promise = WebInspector.Revealer.revealPromise(this.node()); 1639 var promise = WebInspector.Revealer.revealPromise(this.node());
1640 promise.then(() => WebInspector.actionRegistry.action("elements.edit-as- html").execute()); 1640 promise.then(() => WebInspector.actionRegistry.action("elements.edit-as- html").execute());
1641 }, 1641 },
1642 1642
1643 __proto__: TreeElement.prototype 1643 __proto__: TreeElement.prototype
1644 } 1644 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698